Thank you, it helped.
It is the fact that in ES up till now, {} block were always delimited by
a keyword (if/else is probably the only case when two blocks were
present). So it is not a bad idea to retain it.
The problem with this is, one can put arguments in normal parentheses as
well as paren-free and keywords are only needed in paren-free
scenario... nevertheless. I have an idea. What if this would be allowed:
function myIf(cond, ifBlock myElse elseBlock={||}) {
...
}
that is, to allow to separate formal argument names with keywords, not
only with commas (again, there can be some restriction like only first
few ot last few can be separated this way, so it conforms the overall
goals of the grammar).
Then, one could write (well, never mind now if it needs currying or not,
it is not a topic now):
myIf(a>b) {|| doThisIfAWins() } myElse {|| doThisIfBWins() };
but also (since elseBlock has default value)
myIf(a>b) {|| doThisIfAWins() };
and of course, it still can write
myIf(a>b, {|| doThisIfAwins() }, {|| doThisIfBWins());
though it is a question if it would not be more consistent to do:
myIf(a>b, {|| doThisIfAwins() } myElse {|| doThisIfBWins());
Herby
Brendan Eich wrote:
Herby Vojčík <mailto:[email protected]>
January 15, 2012 1:24 AM
"Nothing is going to match Smalltalk on this. Keyword parameters are
not even on the map because object literals suck the oxygen out of the
room. And then you'll want to get rid of the || for empty block
parameters."
===
Sorry for this question, it is more a meta one. The paragraph above
seems too dense for me to digest (and I thought my English is pretty
good). Would it be possible to explain a little more? Like what is
meant by "going to match"
"be as good as" Smalltalk.
and what is "this" in "on this;
"on keyword selector syntax".
and things like "not in the map"
No strawman or even idle chatter about adding keyword parameter passing
to JS.
, "o.l. suck the oxygen out of the room", and the last sentence, too.
We have discussed here and in TC39 how {key: val} actual parameters in
the language already (object literals) remove most of the justification
and almost all motivation for adding key: val parameter syntax to call
expressions.
Thank you, Herby
Hope this helps.
[ did you know you quoted cca 50 screens? 8-O I took the liberty of
omitting them. ]
I'm using a new mail user agent and it does tend to overcite. Sorry,
will try to fix.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss