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

Bob Ippolito <>
Thu Nov 20 12:59:26 CET 2008


On Thu, Nov 20, 2008 at 2:14 AM, Thomas Lindgren
<> wrote:
>
>
>
> --- On Thu, 11/20/08,  <> 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