foolang
foolang copied to clipboard
consider syntax change: `[]` vs `{}`
Currently []
is always an array, whereas {}
is sometimes a block, sometimes a dictionary, sometimes a record...
Blocks are absolutely central. I think it might be a good idea to reserve either for them, and have the other one be the non-block object constructor workhorse.
eg:
[ :x | x abs ] --> Smalltalky block
{ foo = bar, quux = zot } --> Record
{ "foo" -> bar, "quux" -> zot } --> Dictionary
{ foo bar, quux zot } --> Array
Even more so, if ->
becomes an association operator (or syntax), specific dictionary syntax can be replaced with:
{ "foo" -> bar, "quux" -> zot } asDictionary
Records and arrays are far more fundamental than dictionaries - though making non-syntax like that makes actual literal immutable dictionaries a tricky proposition -- but there should be syntax to allow compile-time construction of literal objects anyhow (in addition to define
).