Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

removed undefined from Core__Nullable#171

Open
jquesada2016 wants to merge 1 commit intorescript-lang:mainrescript-lang/rescript-core:mainfrom
jquesada2016:170jquesada2016/rescript-core:170Copy head branch name to clipboard
Open

removed undefined from Core__Nullable#171
jquesada2016 wants to merge 1 commit intorescript-lang:mainrescript-lang/rescript-core:mainfrom
jquesada2016:170jquesada2016/rescript-core:170Copy head branch name to clipboard

Conversation

@jquesada2016
Copy link

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

@DZakh
Copy link
Member

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.