[erlang-questions] Maps branch and disclaimers
Wed Oct 30 15:24:20 CET 2013
On 2013-10-30 15:03, Chris King wrote:
> On Wed, 30 Oct 2013 09:51:27 -0400, Björn-Egil Dahlberg
> <> wrote:
>> I don't get this use case. Why do you need syntax support for a
>> key-value map where you don't know a priori what the keys and
>> values are? Why don't dict() and friends suffice?
>> To me this is akin to iterating through a record/tuple.
> Actually these functions are needed, at least one is needed
> internally, I think.
> It should be covered in comprehensions with Maps generators. Maps
> generators needs next(Key, Map).
> But for small Maps and record like behaviour they are not needed. =)
> Mm, I think I disagree about the need for map-generators as well.
> Couldn't that be equally well served by implementing a qlc dict() source?
What I meant was it needs a stepping structure internally. I don't think
next(K,M) would suffice here though, need to think about it a bit more.
All the comprehensions, generators, next, prev, tree structures and
variables in keys goes hand in hand and those are a bit down the road.
Don't fret about it =)
> Well I shouldn't complain too much. Richard O'Keefe and I both argued
> strenuously against conflating heterogeneous (record-like) and
> homogeneous (dict-like) maps months ago but I guess that ship has sailed.
> I will just avoid using the dict-like features of these maps in my
> code, and hope that I am not forced to do so by the standard library
> or by popular applications.
> BTW, is there a plan for a type notation for these new maps, or for
> how to get Dialyzer to usefully type-check them?
Yes. The type notation is the same as with other terms. How well
Dialyzer would be able to handle it is a different matter. I plan to
make them really stupid at first, meaning opaque map(). Later
incarnations of dialyzer could be increasingly smarter.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions