People don't default on the caller side (at the callsite) much, in my
experience. Dave may be seeing other sources, but it's extremely rare in
my experience to see
foo(arg1 || callers_idea_of_default_arg1_value);
whereas we all see
function foo(a, b, c) {
a = a || default_a;
b.x = b.x || default_b_x;
b.y = b.y || default_b_y;
c.z = function (w) {
// long body here
}
...
}
Plain and destructuring parameter default values help with a and b
(provided the default_* expressions are small and don't require other
locals that are computed based on complex conditions, etc.). c.z is
harder to fit in the parameter list neatly.
It may be that ?= won't see much use, once p.d.v.s are in. Hence the
strawman status while p.d.v.s are in ES6.
/be
Ryan Florence wrote:
Sorry, I misunderstood.
CoffeeScript has ? (no ternary, so its doable there) but I haven't
seen it used much.
On Jun 12, 2012, at 11:14 PM, David Herman wrote:
On Jun 12, 2012, at 7:41 PM, Ryan Florence wrote:
I'm skeptical. You don't foresee
f(obj.x ?? defVal)
happening a lot? I do.
I can't speak for the world but I've never seen anybody do f(val ||=
defVal) in Ruby or CoffeeScript.
But I'm not talking about ||=. I'm talking about the analog of ||.
Dave
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss