[erlang-questions] Accessing a single value from MAPS

Robert Virding rvirding@REDACTED
Fri Oct 9 02:33:01 CEST 2015


In that case skip the dot and use Map#{key} which does look a bit strange
but I don't think causes any problems. It at least looks "mappy".

Robert


On 8 October 2015 at 16:18, zxq9 <zxq9@REDACTED> wrote:

> WHAT?!?!?
>
> All that inconsistency in the language SO PEOPLE CAN USE GODDAM DOTS?!?!?
>
> NO!
>
> OK. That's out of my system.
>
> Seriously, what is this obsession with dots? It amazes me that this sort
> of thing comes up so often, is demonstrated to be a bad idea, and then
> comes up again weeks later. Thoughtlessly adding syntactic sugar without a
> reason better than "braces and hashes and whatnot are considered ugly by
> (my) current fashion standards" is how you wind up with an unrecoverable
> stew of profoundly weird and unrecoverably ugly syntax and semantics.
> Consider Ruby. Or C++. Compare that to Python, where adding a syntactic
> convenience usually requires something close to a multi-year civil war. The
> difference in outcome is clear.
>
> I would much prefer that Erlang continued to err on the side of being too
> slow to depart from its Prologish syntax roots and remain consistent and
> unsurprising, regardless the prevailing syntax fads of this or that decade.
> In fact, I would prefer if most of the code I see continues uses
> maps:get/2,3 and wouldn't be bothered at all if there had never been any
> specific hash-and-braces-sometimes-with-arrows syntax for maps.
>
> The syntax of maps is utterly uninteresting -- the underlying data
> structure is the useful part.
>
> -Craig
>
> On 2015年10月8日 木曜日 17:55:07 Tony Rogvall wrote:
> > Why not only support atom keys for the dot notation and let more complex
> keys use maps:get???
> > That would cover most of my uses of maps ( but far from all )
> > /Tony
> > > On 8 okt. 2015, at 16:47, Fred Hebert <mononcqc@REDACTED> wrote:
> > >
> > >> On 10/08, Fred Hebert wrote:
> > >> Map.f.'d.e'.#{a@REDACTED=>ok} to go fetch the final 'ok'. Either that or
> you·
> > >> support little chaining, but there's still plenty of ways to make
> this·
> > >> terrible.
> > >
> > > Oh also, if any form of chaining is required, it is now impossible to
> know if Map.3.5 is supposed to be Map.(3.5) or two maps, one with the key 3
> and the key 5. I guess parentheses could make it work. But even with
> records this was kind of messy.
>
>
> _______________________________________________
> 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/20151008/3b92dc8e/attachment.htm>


More information about the erlang-questions mailing list