calysto_scheme
calysto_scheme copied to clipboard
Different indistinguishable dicts
Hi, I noticed (after some troubleshooting) that dicts created by (dict ...)
and by (python-eval "...")
look exactly the same but behave differently:
(define a (python-eval "{'a' : 1}"))
a => {'a' : 1}
(define b (dict '(b : 2)))
b => {'b' : 2}
(get-item a 'a) => 1
(get-item b 'b) => error
(get-item a "a") => 1
(get-item b "b") => 1
While I know that that behaviour is to be expected, couldn't its representation be different to emphasize the incompatibility? e.g.
b => {"b" : 2}
or change the symbol-based one
a => {'a : 2}
If you could make a pull request, that would be great.
Fixed in Calysto Scheme 1.4.8. All dictionaries use strings as keys, but now will automatically convert symbols to strings if needed. Thanks for reporting!