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

Null is a primitive type - does it need a lib? #96

Open
crusso opened this issue Jun 29, 2020 · 8 comments
Open

Null is a primitive type - does it need a lib? #96

crusso opened this issue Jun 29, 2020 · 8 comments

Comments

@crusso
Copy link
Contributor

crusso commented Jun 29, 2020

TIL Null implements == and !=, but why bother? (o == null does not work for options o : ? T, only for o : null.

@crusso
Copy link
Contributor Author

crusso commented Jun 29, 2020

@rossberg?

@nomeata
Copy link
Contributor

nomeata commented Jun 29, 2020

Just to keep the flow of unhelpful comments going: how about we ditch the Null type and have null : ?empty? (I may have asked this before and have forgotten the reason)

@crusso
Copy link
Contributor Author

crusso commented Jun 29, 2020

I've forgotten the answer, but why is the better and not just uglier?

@rossberg
Copy link
Contributor

Wait, why does option == null not work? That would be a bug, given that Null is a subtype.

@nomeata
Copy link
Contributor

nomeata commented Jun 30, 2020

I've forgotten the answer, but why is the better and not just uglier?

It’s maybe better because we don’t need to explain why there is a separte type called Null, why Null and ?t are related etc.

But I guess that ship has sailed anyways since we have null in Candid…

@crusso
Copy link
Contributor Author

crusso commented Jul 8, 2020

Wait, why does option == null not work? That would be a bug, given that Null is a subtype.

Why should that work? We don't derive equality functions for option (they are generic). Unless you want to special case that options of equality type admit equality, but then why not do that consistently for all equality types.

@crusso
Copy link
Contributor Author

crusso commented Jul 8, 2020

FTR, ordering on null is not supported (though equality is).

@rossberg
Copy link
Contributor

Why should that work? We don't derive equality functions for option (they are generic).

Ah, right.

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

No branches or pull requests

3 participants