[erlang-questions] Maps branch and disclaimers

Tomas Abrahamsson tomas.abrahamsson@REDACTED
Sat Oct 26 17:40:45 CEST 2013


Björn-Egil Dahlberg writes:
> 2013/10/26 Tomas Abrahamsson <tomas.abrahamsson@REDACTED>
>> Here you go, Maps!
>> 
>> I've pushed a Maps branch to Erlang/OTPs repository at GitHub.

>     I also stumbled upon an what appears to be a compiler error.

> I believe I found the bug. My attention is a bit split right now so I'm
> not completely sure .. watching Vancouver Canucks beat the Blues, and
> watching WCS Season 3.

> However I think the allocate stack above a fail label which may jump
> over a deallocate causes this problem. The following will solve the
> problem:

Hehe, Nice work, especially considering split attention :)
It appears to work well: no more compiler errors,
and the code seems to runs fine.

I did some tests for map update perforamnce as well.  It was
3--4% faster than corresponding record updates, when
updating one field at a time for each parse message
field. Very nice!

One question: will it be possible to use single-field map
accesses in guards, for example in if clauses, the same way
single-field record accesses can be used? For example:

     if V1#msg.type == x -> something;
        V2#{type} == x   -> something_else
     end

I suppose that will be the case, but didn't find
it explicitly stated in the eep.


BRs
Tomas



More information about the erlang-questions mailing list