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

removed undefined from Core__Nullable #171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jquesada2016
Copy link

This PR addresses #170. It simply removes external undefined from the Nullable module.

@DZakh
Copy link
Contributor

DZakh commented Dec 15, 2023

Undefined is part of nullable. There's Null.t if you dont't need undefined

@jquesada2016
Copy link
Author

Wouldn't this be more clear if we had an Undefinable module to seperate null from undefined. I've run across this issue working with JSON.stringifyAny where one of the types is Nullable.t<'a>, and it skipping the field rather than putting null when the value is supposedly null.

@illusionalsagacity
Copy link
Contributor

Wouldn't this be more clear if we had an Undefinable module to seperate null from undefined.

If you want strictly undefined or 'a you probably want an option<'a> instead as that sounds like it'd match your expectations here; and I don't think introducing a breaking change to Core when this matches the behavior of the old Js module would help with the migration path

I've run across this issue working with JSON.stringifyAny where one of the types is Nullable.t<'a>, and it skipping the field rather than putting null when the value is supposedly null.

That sounds like it matches the JavaScript implementation to me:

JSON.stringify({hello: undefined, world: "foo"}) // outputs '{"world":"foo"}'

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 this pull request may close these issues.

3 participants