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

[Proposal]: never/bottom type #8604

Open
333fred opened this issue Nov 18, 2024 · 0 comments
Open

[Proposal]: never/bottom type #8604

333fred opened this issue Nov 18, 2024 · 0 comments
Assignees
Milestone

Comments

@333fred
Copy link
Member

333fred commented Nov 18, 2024

never/bottom type

Summary

A new type that has no instances and is a subtype of every other type can be introduced, called never or bottom. It will be the official return type of the throw expression and will allow transforming return, break, continue and goto into expressions (see #176). This will allow them in all expression contexts where never is combined with another type (&&, ||, ??, ?:) or discarded (expression statements). Instantiating variables/fields of type never should be impossible.

It can either be implemented as a real CLR type (well, as real as void) or as a compiler trick (never-returning methods are actually void with a NeverReturnsAttribute).

Design meetings

@dotnet dotnet locked and limited conversation to collaborators Nov 18, 2024
@333fred 333fred self-assigned this Nov 18, 2024
@333fred 333fred added this to the Backlog milestone Nov 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant