Map literal

Isiah Meadows isiahmeadows at
Mon Nov 30 01:41:53 UTC 2015

I like the idea of the #{} syntax working without a required type. But
here's my opinions:

1. It should automatically [[Construct]]. I don't see any other reason why
it shouldn't.
2. I don't like the idea of an `->` operator which does that. Also, is `a
-> b -> c` equivalent to `[a,  b, c]` or `[a, [b, c]]`? I just don't like
3. I can see why you want an untyped version to destructure into a list of
2-tuples, but I fear it would lead into the same pitfalls of the extreme
consistency in `this`. Every ES5 function has its own `this`, which led
people into problems when they forgot about it when using inner functions.
Forth is one of the simplest, most consistent languages out there (it's an
old concatenative, stack-based language, for those unfamiliar). But it's
easy to trip up if your stack has the wrong value, it leaves one too many
values on the stack, or you pass one too few values to it. And this fails

On Sun, Nov 29, 2015, 16:41 Francisco Tolmasky <tolmasky at> wrote:

> My one desire (perhaps not completely substantiated) would be that the
> “list” portion of the syntax exist outside of these expressions as well.
> That is to say, if:
> ```
> new Dict#{a: b, c: d }
> ```
> desugars to:
> ```
> new Dict([[a,b], [c,d]])
> ```
> Then I’d like/expect #{a: b, c: d} to also just desugar to [[a,b], [c,d]].
> More than anything, I would just expect this to be the case if I ran into
> it in the wild. As such, perhaps one way to look at this is that what we
> actually want is a nice tuple syntax. Imagine if we had just a tuple syntax
> taht a->b desugars to [a,b]. Now, with no further changes, we get this “map
> syntax” for free:
> ```
> new Map([a->b, (4+5)->d, null->7])
> ```
> That looks pretty good to me, and introduces a new operator that behaves
> the same everywhere, and has minimal requirements to “new” collection
> classes. Additionally, I would enjoy returning these as well when referring
> to key value pairs:
> ```
> return (a->b) // sugar for return [a,b]
> ```
> --
> Francisco Tolmasky
> tolmasky at
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list