new syntax - a provocation
Joe Armstrong
joe@REDACTED
Wed Sep 24 17:19:44 CEST 2003
On Wed, 24 Sep 2003, Richard A. O'Keefe wrote:
> Joe Armstrong <joe@REDACTED> wrote:
> - Proper structs
>
> << junk the record stuff. thus has been discussed in previous
> mails >>
>
> I never thought I'd recommend anything from IBM Prolog, but it turns out
> that "IBM PROLOG for 370" had something that LIFE had and that I've long
> wanted in Erlang. The things I want have been known by various names in
> various languages: "tables" in SNOBOL, "Dictionaries" in Smalltalk,
> "associative arrays" in AWK, "hashes" in Perl, "psi-terms" in LIFE,
> "feature structures" in linguistics, and who knows what elsewhere.
>
>
> In this message, I'm going to call them dictionaries.
>
> A dictionary is a finite collection of (key,value) pairs such that
> all keys are atoms and no two keys are equal. The values may be any
> Erlang terms.
>
> Functions:
... cut ...
These are what I called "proper structs"
I posted an article about this in 2001 I can repost if you're interested ...
My structs were written
~{K1=V1, K2=V2, ...}
or
~Tag{K1=V1, ...}
(So that you could name an entire struct)
Update was written
Var~{K1=NewV1, ...}
etc.
~Tag{...} works just like #Tag{....} works today
but with the difference that everything is dynamic - so whereas
#Tag{...} needs a -record(Tag, {...}) definition ~Tag{...} does not
/Joe
More information about the erlang-questions
mailing list