[erlang-questions] New draft of frames proposal (was Re: Frames proposal)

Tim McNamara paperless@REDACTED
Thu May 3 13:02:07 CEST 2012


On 3 May 2012 22:50, José Valim <jose.valim@REDACTED> wrote:
>> I don't understand this example [p16]
>>
>>    foo:bar(Ugh),
>>
>> How is this ambiguous? Are you trying to set the bar element from the
>> foo frame? Your next line is unclear.
>
>
> It is ambiguous because:
>
>     { foo:bar(Ugh) }
>
> Could be a tuple with one element which is the result of foo:bar(Ugh) or
> a frame with key foo and value bar(Ugh) (according to your proposal).
> There is also the "ambiguity" in {}. Is it an empty frame or an empty tuple?

Ah, understood. There is certainly an opportunity for error here.
Could {:} represent the empty frame?

>
> <{ foo: bar(Ugh) }> could work because there would be no ambiguity for
> the compiler, but it would be still ambiguous for humans (damn you, humans).
> I would shrug if I read a code like <{ foo:bar(Ugh) }> that actually means
> <{ foo: bar(Ugh) }>.

FWIW, I think this is probably acceptable. If <{ }> was accepted, it
implies an intent on the programmer's behalf that they wanted to
create a frame, which requires a key and a value.



More information about the erlang-questions mailing list