Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Nit: "nullary" misused #3

Closed
BrendanEich opened this issue Jul 25, 2017 · 25 comments
Closed

Nit: "nullary" misused #3

BrendanEich opened this issue Jul 25, 2017 · 25 comments

Comments

@BrendanEich
Copy link

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

@ljharb
Copy link
Member

ljharb commented Jul 25, 2017

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?

@gisenberg
Copy link
Member

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!

@rattrayalex
Copy link

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

@ljharb
Copy link
Member

ljharb commented Jul 28, 2017

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

@claudepache
Copy link

@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.

@ckknight
Copy link

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

@claudepache
Copy link

@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.

@rbuckton
Copy link

rbuckton commented Oct 7, 2017

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.

@rattrayalex
Copy link

rattrayalex commented Oct 7, 2017

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:

@rattrayalex
Copy link

Nil or nil

@rattrayalex
Copy link

nullish

@rattrayalex
Copy link

nully

@rattrayalex
Copy link

nullary

@rattrayalex
Copy link

nundefined

@claudepache
Copy link

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

@ljharb
Copy link
Member

ljharb commented Oct 9, 2017

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.

@keithamus
Copy link
Member

https://twitter.com/Keithamus/status/917503945676800000

image

@Mouvedia
Copy link

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

@keithamus
Copy link
Member

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

@Mouvedia
Copy link

@keithamus Would you introduce truthy without falsy?

@keithamus
Copy link
Member

@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?

@rattrayalex
Copy link

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
Copy link

@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)

@rattrayalex
Copy link

@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.

@gisenberg
Copy link
Member

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants