arr-ai / arrai

The ultimate data engine.
http://arr.ai
Apache License 2.0
20 stars 15 forks source link

//fmt.pretty doesn't output valid arr.ai syntax #516

Closed marcelocantos closed 4 years ago

marcelocantos commented 4 years ago

Please do not post any internal, closed source snippets on this public issue tracker!

Description

Where possible, //fmt.pretty should output valid syntax. When pretty-printing dicts with string keys, the function outputs bare strings, which means the output can't be copy-pasted back into arr.ai. It can also lead to some weird behaviour (albeit under some pathological edge cases).

Steps to Reproduce

@> //fmt.pretty({'a: 1, b':1})
{
  a: 1, b: 1
}
{'a: 1, b': 1}
@> //fmt.pretty({'42': 1, 42:2})
{
  42: 2,
  42: 1
}
{42: 2, '42': 1}

Expected behavior

Output values as valid arr.ai syntax.

Actual behavior

Bare strings as keys.

Your Environment

$ arrai info
Version    : 65402d624e76a7af10a9bf7e4eb0e8e627526d01 (from v0.96.0)
Git commit : 65402d624e76a7af10a9bf7e4eb0e8e627526d01
Date       : 2020-07-21T10:10:57Z
OS/arch    : linux/amd64
Go version : go1.14.3 linux/amd64