Existential operator (was: ||= is much needed?)
Brendan Eich
brendan at mozilla.org
Wed Jun 20 12:31:26 PDT 2012
Allen Wirfs-Brock wrote:
> yes, that's what I was proposing. I think calls need to be part of the overall discussion for this feature area.
Jeremy is kindly grepping more codebases, but just from CoffeeScript
(self-hosted) source itself, ?. is 42, ?[ is 7, and ?( is 3 -- so
12:2:1. Supports deferring ?( for now given syntax issue, but the
counter-argument is that we might solve syntax holistically a different
way. One idea:
foo.?bar instead of foo?.bar
which enables
foo(? args )
instead of
foo?( args )
and implies
foo[? index ]
This is infelicitous compared to putting ? first because it separates
the ? from the maybe-nully left operand too much, and looks ugly (to
Spanish readers it looks even more wrong).
The other idea mooted:
foo?:( args )
runs into the X ?: Y problem -- that should mean X ? X : Y per GNU C and
intuition, but the : in the middle of ?:( doesn't mean any such thing.
My super-flammable straw syntax of foo?.(args) has a similarly inapt dot
in the middle.
Suggestions welcome. If we must get maybe-call in or at least
future-proof the syntax for it a bit, now is the time.
/be
More information about the es-discuss
mailing list