tc39 / proposal-nullish-coalescing

Nullish coalescing proposal x ?? y

Home Page:https://tc39.github.io/proposal-nullish-coalescing/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nit: "nullary" misused

BrendanEich opened this issue · comments

This is minor, but worth getting right: per https://www.bing.com/search?q=nullary+definition, "nullary" means taking no arguments or having trivial domain. Thus if null or undefined is a nullary value so are 42, "hi", and false.

Precedent in es-discuss is to use some variation on existential operator, but there are too many variations ;-). CoffeeScript uses "soak", which is evocative. Not sure what to suggest, but I don't think "nullary" should be abused. Thanks.

https://esdiscuss.org/topic/existential-operator-null-propagation-operator

I suggested the term to mean "null or undefined"; if it has an actual meaning that differs than we certainly shouldn't use the term.

I think it's valuable to have an "X coalescing operator", where "X" means "null or undefined" - do you have thoughts on a good term for that?

I've updated the slides to refer to this feature as the existential operator. The CoffeeScript flavor of this operator (http://coffeescript.org/#existential-operator) specifically applies to null and undefined values, so it seems like a pretty good match. If there's committee consensus on the slides, then I'll update the repo/docs to match.

Thanks for the catch!

Nil seems to be the term used most in the optional-chaining proposal. Thoughts?

To me that's confusing about to which it applies (null, undefined, or both)

@rattrayalex

Nil seems to be the term used most in the optional-chaining proposal. Thoughts?

In the context of the optional-chaining proposal, it didn't mean that.

I use the term "nullish" to refer to either null or undefined. Kinda similar to the terms "truthy" and "falsy".

@gisenberg

I've updated the slides to refer to this feature as the existential operator. The CoffeeScript flavor of this operator (http://coffeescript.org/#existential-operator) specifically applies to null and undefined values, so it seems like a pretty good match.

The name “existential” does not suggest by itself “undefined or null”. You must have some CoffeeScript background in order to know that.

Moreover, CoffeeScript also uses the term “existential operator” (as well as the same symbol ”?”) for optional chaining, which is semantically different than nullish-coalescing.

“Nullish” seems a fine replacement for “nullary”. Or even “null”, as I don’t think that anyone would be confused by thinking it would not apply to undefined as well.

Given we often use the terms "truthy" and "falsy", you could use the term "nully". Alternatively, we could use the portmanteau "nundefined" 😉. Generally its described as a "null-coalescing-operator", though that's less appropriate in the case where we are encompassing undefined here. Perl defines it as the "Logical Defined-Or" operator.

Some quick stats; Google search results quantity for...

  • javascript nil - About 771,000 results
  • javascript nullish - About 566,000 results
  • javascript nully - About 31,400 results
  • javascript nullary - About 23,100 results

(my hunch is that many of the nil searches were confused rubyists wanting null, not null or undefined)

It's unclear to me if this is a moot point (the operator itself has been renamed to "existential", but there seems to be a persistent desire to describe "null or undefined" regardless).

I'll do a quick poll anyway:

Nil or nil

nullish

nully

nullary

nundefined

@rattrayalex There is also:
null
(and let context making clear that undefined is implicitly included)

Whatever term we choose here, it's going to be whatever the community zeitgeists on - "null" isn't going to survive that test, and i'm pretty sure "nundefined" won't either.

Since "nullary" isn't good, "nullish" or "nully" are probably the only two that have a chance of the community embracing it.

Informative but nully must be followed by (akin to truthy and falsy) else it doesn't make sense.

@Mouvedia if it has to be described with such a context then maybe it is not the right word to use?

@keithamus Would you introduce truthy without falsy?

@Mouvedia I'm not sure the point you're trying to make. My suggestion is that if you need to describe how nully works given a context, maybe it isn't a suitable candidate?

Esp; given previous comment:

“Nullish” seems a fine replacement for “nullary”

@claudepache do you feel good about declaring nullish the term we'll use for now and closing this thread?

@claudepache do you feel good about declaring nullish the term we'll use for now and closing this thread?

I have no right on this repo (ask @gisenberg)

@gisenberg reacted with 👍 to that question so I'll take that as a "case closed; nullish is the preferred term to describe 'null or undefined'" unless posted otherwise.

Based on the feedback in this issue, I've updated all references to nullary to nullish.