jjl / lfe

Lisp Flavoured Erlang (LFE)
Apache License 2.0
0 stars 0 forks source link

Collection literals #1

Open jjl opened 8 years ago

jjl commented 8 years ago

One of the fundamental properties of a lisp IMO is that most forms should not quote their contents automatically.

In LFE, a list does not autoquote its contents, nor do the 'wordy' collection syntaxes, yet for tuple and map syntaxes, it is assumed that everything is quoted by default and the only way to 'undo' this is to force the matter by quasiquoting the whole literal and interpolating the value required.

This doesn't feel right and it doesn't feel consistent. My first proposition is thus that we do not have any auto-quoting collection literal syntax. If a user wishes to avoid evaluation, they can use a quote. I believe the common case is to not want the contents to be autoquoted as this limits flexibility.

I secondly propose that we steal clojure's map syntax ({}) and repurpose [] for tuples. The major downside to this is that for an erlanger, [] are for lists and {} are for tuples, so it could be confusing. I don't think we're really aiming mostly at erlangers, so I'm inclined to say that this is not so much of a problem - especially when there is a big visual clue from the code that this is not erlang code.

This will mean that: