On Thu, Jun 14, 2012 at 6:06 PM, Aymeric Vitte <vitteayme...@gmail.com>wrote:
> This discussion I think is going into a useless complexity. > > Nobody (except w3c) is using null, or when someone is using it, it is the > same way as undefined, and it is not explicit (ie a||b or a==b, not > a===null), I remind some old code where we could see the use of null but > can not find a single example of recent code, then the new operator(s) > should treat it the same way I believe, the problem is 0 here > There doesn't need to be an explicit check for undefined - anytime null is used as an intentional place holder and its value would be _otherwise_ undefined counts as well. And for your information, I am not w3c and I use null frequently (the same way w3c uses it). Rick > > Le 14/06/2012 23:16, Rick Waldron a écrit : > > > > On Thu, Jun 14, 2012 at 3:45 PM, Brendan Eich <bren...@mozilla.com> wrote: > >> Rick Waldron wrote: >> >>> >>> One way to have it both ways is to have multiple syntactic forms >>> for default value initializers. EG: >>> >>> function f(a = 1, b ??= 2, c ||= 3) { } //assuming ??= is >>> undefined or null defaulting guard and ||= is falsy >>> >>> I'm not particularly convinced that the additional complexity is >>> warranted but it would place the choice into ES programmers hands >>> rather us trying to anticipate the typical intent and >>> disadvantaging the untypical. >>> >>> >>> I agree with this entirely. >>> >> >> Including the part where Allen is not convinced to add all these forms? >> > > Yes. > > ...But it felt useful to note that ||= would compliment || and > immediately understood by devs > > > >> >> I can see adding ?? and ??= (undefined-only, not undefined-or-null). >> > > Yes, absolutely. > > >> >> Is ||= really worth it? It would not assign if the left side is truthy, >> but perhaps no one will mind. > > > That makes complete sense to me, but again - it might not be worth > adding, because a = b || c isn't that painful. > > >> >> Given ||= is there any oxygen left in the room for ??=? > > > Right now, I believe the whole set compliment the current language and > its operators nicely - but if it came down to one or the other, I would > prefer seeing the new addition of ?? and ??= > > > Rick > > >> >> >> /be >> >> >>> ||= is complementary to || and makes sense - developers will embrace >>> this as is. >>> >>> >>> ?? and ??= seem like "something is unknown" and unknown things can >>> otherwise be described as "undefined". Definitively, |null| is intentional >>> -- which implies something "known" and therefore cannot qualify as >>> "undefined". I think sticking to undefined will help to fix the abused "== >>> null" patterns in extant code (I'm thinking in the long term of course) >>> >>> If null testing is needed: >>> >>> a = a != null ? a : default; >>> >> > > > _______________________________________________ > es-discuss mailing > listes-discuss@mozilla.orghttps://mail.mozilla.org/listinfo/es-discuss > > > -- > jCore > Email : avi...@jcore.fr > Web : www.jcore.fr > Webble : www.webble.it > Extract Widget Mobile : www.extractwidget.com > BlimpMe! : www.blimpme.com > >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss