Re: Default operator strawman - ||| rather than ??

2012-06-16 Thread T.J. Crowder
On 16 June 2012 01:44, Brendan Eich bren...@mozilla.com wrote: T.J. Crowder wrote: On 15 June 2012 22:22, Brendan Eich bren...@mozilla.org mailto: bren...@mozilla.org wrote: If everyone's opinion carries weight, then we are tied :-P. Kidding. But aside from opinions and their

Re: Default operator strawman - ||| rather than ??

2012-06-16 Thread Herby Vojčík
Brendan Eich wrote: In fact, I don't think I was pushing any particular syntax. I think I was clear about asking _whether_ people saw value in the semantics of it, not the syntax. It's fine if people don't see value; is there a problem with asking the question? I was describing the hazards

Re: Default operator strawman - ||| rather than ??

2012-06-16 Thread Herby Vojčík
Herby Vojčík wrote: Brendan Eich wrote: In fact, I don't think I was pushing any particular syntax. I think I was clear about asking _whether_ people saw value in the semantics of it, not the syntax. It's fine if people don't see value; is there a problem with asking the question? I was

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread T.J. Crowder
I think the original thrust of this thread may have got lost a bit in the (useful) discussion of null and undefined, so coming back to the original point: On 12 June 2012 16:29, T.J. Crowder t...@crowdersoftware.com wrote: In the current default operator strawman[1], the operator is ??, e.g.:

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread Erik Arvidsson
On Fri, Jun 15, 2012 at 6:28 AM, T.J. Crowder t...@crowdersoftware.com wrote: Does anyone have an opinion on a second ternary a'la the above (syntax notwithstanding). So far we have only my opinion (I like it and would have uses for it; I don't _need_ it), Brendan's (too thin)[1], and Herby's

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread T.J. Crowder
On 15 June 2012 18:05, Erik Arvidsson erik.arvids...@gmail.com wrote: Since you are asking for opinions. I don't want it. It doesn't carry its own weight. I was, and that includes opinions against. Thanks! -- T.J. ___ es-discuss mailing list

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread Brendan Eich
Erik Arvidsson wrote: On Fri, Jun 15, 2012 at 6:28 AM, T.J. Crowdert...@crowdersoftware.com wrote: Does anyone have an opinion on a second ternary a'la the above (syntax notwithstanding). So far we have only my opinion (I like it and would have uses for it; I don't _need_ it), Brendan's (too

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread T.J. Crowder
On 15 June 2012 22:22, Brendan Eich bren...@mozilla.org wrote: If everyone's opinion carries weight, then we are tied :-P. Kidding. But aside from opinions and their weight, we have a problem if wouldn't hurt is the answer for syntax proposals. Who said it was? New syntax does hurt. It

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread Brendan Eich
T.J. Crowder wrote: On 15 June 2012 22:22, Brendan Eich bren...@mozilla.org mailto:bren...@mozilla.org wrote: If everyone's opinion carries weight, then we are tied :-P. Kidding. But aside from opinions and their weight, we have a problem if wouldn't hurt is the answer for syntax

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread Brendan Eich
Brendan Eich wrote: * It brings new semantics not expressible in the language (let, const, modules, generators). * It is an affordance without new semantics for a common pattern that's verbose and error-prone when open-coded. Classes (maximally minimal, mainly for extends and super) is a

Re: Default operator strawman - ||| rather than ??

2012-06-14 Thread John Lenz
My two sense. In my experience (large applications, rather than tight libraries), distinguishing between null and undefined is the exception, not the rule. When it is distinguished, as often as not the author would be more correct in either including null or making an property existence check

Re: Default operator strawman - ||| rather than ??

2012-06-14 Thread Domenic Denicola
In our experience writing large apps, the distinction is useful. Undefined means I forgot to do something (e.g. set a property or pass an argument); null means I tried to get something but it didn't exist. Very roughly, it becomes undefined = caller error outside of my control, null = my error

Re: Default operator strawman - ||| rather than ??

2012-06-14 Thread Rick Waldron
On Thu, Jun 14, 2012 at 11:58 AM, Domenic Denicola dome...@domenicdenicola.com wrote: In our experience writing large apps, the distinction is useful. Undefined means I forgot to do something (e.g. set a property or pass an argument); null means I tried to get something but it didn't exist.

Re: Default operator strawman - ||| rather than ??

2012-06-14 Thread Domenic Denicola
On Jun 14, 2012, at 14:03, Rick Waldron waldron.r...@gmail.commailto:waldron.r...@gmail.com wrote: On Thu, Jun 14, 2012 at 11:58 AM, Domenic Denicola dome...@domenicdenicola.commailto:dome...@domenicdenicola.com wrote: In our experience writing large apps, the distinction is useful. Undefined

Re: Default operator strawman - ||| rather than ??

2012-06-13 Thread Thaddee Tyl
On Tue, Jun 12, 2012 at 10:17 PM, David Herman dher...@mozilla.com wrote: On Jun 12, 2012, at 6:33 PM, Thaddee Tyl wrote: My point still stands. Being undefined-specific is arbitrary. CoffeeScript could have been undefined-specific; they were undefined + null-specific, which I believe makes

Re: Default operator strawman - ||| rather than ??

2012-06-13 Thread Herby Vojčík
Thaddee Tyl wrote: On Tue, Jun 12, 2012 at 10:17 PM, David Hermandher...@mozilla.com wrote: On Jun 12, 2012, at 6:33 PM, Thaddee Tyl wrote: My point still stands. Being undefined-specific is arbitrary. CoffeeScript could have been undefined-specific; they were undefined + null-specific,

Re: Default operator strawman - ||| rather than ??

2012-06-13 Thread Tab Atkins Jr.
On Tue, Jun 12, 2012 at 6:33 PM, Thaddee Tyl thaddee@gmail.com wrote: On Tue, Jun 12, 2012 at 6:11 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Jun 12, 2012 at 2:52 PM, Thaddee Tyl thaddee@gmail.com wrote: On the other hand, non-existent properties are a use-case.

Re: Default operator strawman - ||| rather than ??

2012-06-13 Thread David Herman
On Jun 12, 2012, at 11:44 PM, Thaddee Tyl wrote: Besides, it often has a similar meaning: I have seen in a lot of code a de-facto standard wherein null is used to indicate a value that is voluntarily undefined. You can see this pattern all over node.js code, for instance. I *think* this is

Re: Default operator strawman - ||| rather than ??

2012-06-13 Thread Brendan Eich
Tab Atkins Jr. wrote: Okay, further testing shows that my knowledge was incomplete. Null and undefined compare as double-equal, but neither are double-equal to other falsey values. This is intentional, believe it or don't :-P. In ancient days, void 0 was the only way to spell undefined, and

Default operator strawman - ||| rather than ??

2012-06-12 Thread T.J. Crowder
In the current default operator strawman[1], the operator is ??, e.g.: a = b ?? 5; is shorthand for a = b !== undefined ? b : 5; Would it be possible to use ||| instead? E.g.: a = b ||| 5; I ask because I was planning (prior to knowing about this strawman!) to suggest that, along with a

Re: Default operator strawman - ||| rather than ??

2012-06-12 Thread Peter van der Zee
On Tue, Jun 12, 2012 at 5:29 PM, T.J. Crowder t...@crowdersoftware.com wrote: In the current default operator strawman[1], the operator is ??, e.g.: a = b ?? 5; is shorthand for a = b !== undefined ? b : 5; I missed this discussion. What validates the introduction of this syntax over the

Re: Default operator strawman - ||| rather than ??

2012-06-12 Thread Peter van der Zee
If the above is this, absolutely and such a feature, I favor this as Wow, something messed up big time. If the above answer is this, absolute and such a feature is seriously considered ... ___ es-discuss mailing list es-discuss@mozilla.org

Re: Default operator strawman - ||| rather than ??

2012-06-12 Thread Tab Atkins Jr.
On Tue, Jun 12, 2012 at 1:37 PM, Peter van der Zee e...@qfox.nl wrote: On Tue, Jun 12, 2012 at 5:29 PM, T.J. Crowder t...@crowdersoftware.com wrote: In the current default operator strawman[1], the operator is ??, e.g.: a = b ?? 5; is shorthand for a = b !== undefined ? b : 5; I missed

Re: Default operator strawman - ||| rather than ??

2012-06-12 Thread Peter van der Zee
On Tue, Jun 12, 2012 at 10:56 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: undefined is special-cased here because it's an extremely common value to check against.  It's used when an argument isn't supplied, or when you try to pull a non-existent property off of an object. I believe the most

Re: Default operator strawman - ||| rather than ??

2012-06-12 Thread Thaddee Tyl
On Tue, Jun 12, 2012 at 1:56 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Jun 12, 2012 at 1:37 PM, Peter van der Zee e...@qfox.nl wrote: On Tue, Jun 12, 2012 at 5:29 PM, T.J. Crowder t...@crowdersoftware.com wrote: In the current default operator strawman[1], the operator is ??,

Re: Default operator strawman - ||| rather than ??

2012-06-12 Thread Tab Atkins Jr.
On Tue, Jun 12, 2012 at 2:52 PM, Thaddee Tyl thaddee@gmail.com wrote: On the other hand, non-existent properties are a use-case. CoffeeScript provides a similar feature, but for null properties. For example, the following:    o =     a: 1     b: 2    alert o.c?.d compiles to:    

Re: Default operator strawman - ||| rather than ??

2012-06-12 Thread Thaddee Tyl
On Tue, Jun 12, 2012 at 6:11 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Jun 12, 2012 at 2:52 PM, Thaddee Tyl thaddee@gmail.com wrote: On the other hand, non-existent properties are a use-case. CoffeeScript provides a similar feature, but for null properties. For example, the

Re: Default operator strawman - ||| rather than ??

2012-06-12 Thread David Herman
On Jun 12, 2012, at 6:33 PM, Thaddee Tyl wrote: My point still stands. Being undefined-specific is arbitrary. CoffeeScript could have been undefined-specific; they were undefined + null-specific, which I believe makes more sense. Can you make the full argument? I'm genuinely undecided on this