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

Thomas Lindgren thomasl_erlang@REDACTED
Thu Nov 20 11:14:08 CET 2008




--- 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 :-)

Best,
Thomas




      



More information about the erlang-questions mailing list