Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce the Nil Object #136

Closed
greelgorke opened this issue Dec 10, 2014 · 2 comments
Closed

Introduce the Nil Object #136

greelgorke opened this issue Dec 10, 2014 · 2 comments

Comments

@greelgorke
Copy link

Hello and sorry in advance for all typos!

I'd like to introduce a new Object in the core, which consistently represents a null value but is not null. Why is this interesting?

One of the main pain points in Streams (not just core) is that null isn't a good choice for end-of-stream value in object mode. Highland.js resolves it with it's own _.nil value. But this works fine only for the same install. as soon as we have two dependencies, each having it's local highland dependencies, the _.nil check is flawed. a central instance would solve some pains here.

why core? it's the single point of truth in Node.js context. This value could also provide more interoperability to different user-land packages.

@phpnode
Copy link

phpnode commented Dec 10, 2014

@greelgorke I think this is backwards, the problem here is with the streams API not allowing null in some scenarios. Fix that and your problem goes away. Having to write a load of extra guards against Nil and null and undefined thoughout the codebase would be terrible.

@chrisdickinson
Copy link
Contributor

I think this pain point is covered in #89. I was of the same mind re: adding a sentinel value to serve as EOF for readable streams, but I've since come around to the whatwg/streams-style of using a separate function from push to denote "closing" a stream. It is unlikely that we will take the sentinel object approach in enhancing streams in the future.

minervapanda pushed a commit to minervapanda/node that referenced this issue Oct 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants