[erlang-questions] Erlang Syntax - again

Robert Virding rvirding@REDACTED
Wed Mar 12 01:27:57 CET 2008


On 11/03/2008, Mats Cronqvist <mats.cronqvist@REDACTED> wrote:
>
> Jim McCoy wrote:
> > ... Regardless of what records were
> > intended to solve...
> >
>   i believe that the original requirement was something like; "access to
> tuple elements by name, but with zero overhead compared to normal tuple
> access."
>   a pretty tall order (and, with hindsight, misguided)...


Yes, this was one of the original requirements of our first/major users.
They wanted named fields but as fast as using tuples directly. The system
(computer+emulator) wasn't as fast in those days and they felt they couldn't
offer performance. It was not misguided then. Anyway this meant that
everything had to be done at compile-time, which *is* very un-Erlangy.

Some other factors which influenced the syntax:

- No typing in Erlang and no record information in the record (for speed).
This meant that you either have a shared field-name space over all records
with unique field-names over all records or you had to explicitly say which
record type it was. We chose the latter as being more manageable.

- The syntax and semantics of '=' as a match and that it returned the RHS
value which meant that you can do X = {P,Q,R} = ... . There were no aliases
in patterns then. This made a field setting syntax difficult.

Perhaps it would have been better to generate access functions or macros
instead (like lisps and LFE do) but macros were very new then and we weren't
yet into that. That would be possible to add today.

I definitely think it is time to add runtime dynamic structures to the
language. As Richard O'Keefe mentioned there are at least two suggestions
for this, his own and one from Joe.

Robert

  mats
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080312/242e6817/attachment.htm>


More information about the erlang-questions mailing list