[erlang-questions] Re: Special syntax for dictionaries
Richard O'Keefe
ok@REDACTED
Thu May 6 04:19:55 CEST 2010
On May 5, 2010, at 10:02 AM, Tim Fletcher wrote:
>> My proposal for 'frames' has been sitting around for years.
>> I would write that as
>> <{ author ~ "Mike"
>> , text ~ "My first blog post!"
>> , tags ~ ["mongodb","python","pymongo"]
>> , date ~ erlang:now()
>> }>
>
> As much as I dislike the double bracketing I can see the necessity.
You must hate the <<...>> used for binaries, then.
There just aren't any ASCII brackets left.
The double guillemets «» are available in Latin 1,
but are crying out to be used for binaries.
I've searched through Unicode, but apart from lunate
brackets and tortoiseshell brackets, there's not much
that doesn't look too much like other things.
> Is
> there any reason why using the more common choice of ":" to delimit
> the keys and values would be a problem (instead of "~")?
Having too many meanings for the same symbol is too confusing and
error-prone. I didn't use "=" because that already means "match".
I didn't use "->" because that already means "clause". And I
didn't use ":" because that means "module prefix". And it doesn't
just mean "module prefix", it normally has an atom on the left.
The tilde, on the other hand, has no other meaning in Erlang.
Look at a line containing fred:mary(27) and it looks like a
function call. Look at a line containing fred ~ mary(27), and
there is nothing else it could possibly be but a maplet.
Nor is the use of "~" an innovation; much work at Xerox PARC used it.
More information about the erlang-questions
mailing list