[erlang-questions] next(Erlang): "Fix up records so that records are first-class citizens and not just syntax saccharine for tuples?"

Bob Ippolito bob@REDACTED
Thu Nov 20 12:59:26 CET 2008


On Thu, Nov 20, 2008 at 2:14 AM, Thomas Lindgren
<thomasl_erlang@REDACTED> wrote:
>
>
>
> --- On Thu, 11/20/08, attila.rajmund.nohl@REDACTED <attila.rajmund.nohl@REDACTED> wrote:
>> On Thu, 20 Nov 2008, Kostis Sagonas wrote:
>> [...]
>> >     f(..., R = #foo{bar = X, ugh = Y, zoo = Z}, ...)
>> ->
>> >         ...X...
>> >         ...Y...
>> >         ...Z...
>>
>> I know that this is the right Erlang style, but it's so
>> counter-intuitive that
>> the variable which gets the value is on the right hand
>> side...
>
> The intuition is that terms (constants, tuples, records, lists, ...) look more or less the same when written in expressions or patterns.
>
> This idea is not fully carried through, however. The decision not to permit R#foo{...} in patterns (with the same meaning as R = #foo{...}, natch) tends to trip me up, for instance :-)

I constantly get tripped up by that, too.

-bob



More information about the erlang-questions mailing list