[erlang-questions] Frames proposal

Joe Armstrong erlang@REDACTED
Sat Dec 29 14:51:31 CET 2012


On Sat, Dec 29, 2012 at 1:42 PM, Steve Davis <steven.charles.davis@REDACTED
> wrote:

> fixed typo of missed "when" to avoid the distraction from my real question!
>
> On Dec 29, 2012, at 6:39 AM, Steve Davis <steven.charles.davis@REDACTED>
> wrote:
>
> > Looking at the age of the last entry in this thread, it seems that the
> discussion about frames has rather tailed off again. A pity.
> >
> > I'd like to add support for both the introduction of frames (and for the
> EEP 20 on "splitting atoms"). They appear to me to solve fairly pressing
> issues.
> >
> > Personally, I _strongly_ prefer the proposed "erlson form" of notation
> for frames above the suggested <{}> and ~.
> >
> > I do have a question (re: section 8.2 "What we've lost...")... I
> frequently use pattern matching to constrain arguments to type, e.g.:
> >
> > foo(R = #record{}) -> etc
> >
> > In frames, are we limited to:
> > foo(F) when is_frame(F) -> etc
> > ?
>

I think they might be called maps in the future...
maps can have any ground term as a key.

If you want the equivalent of the above you'd have to reserve a
specific key to emulate the record name. So you'd have something like this:

foo(R = #record{}) -> ...
foo(R = #another_record{}) -> ...

would be (with maps) (using the key 'type' to name the record)

foo(#{type=record}=R) -> ...
foo(#{type=another_record}=R) -> ...

/Joe










> >
> > regs,
> > /s
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20121229/108e9231/attachment.htm>


More information about the erlang-questions mailing list