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

Add a "never" value to the language #738

Open
denismerigoux opened this issue Oct 30, 2024 · 3 comments
Open

Add a "never" value to the language #738

denismerigoux opened this issue Oct 30, 2024 · 3 comments
Assignees
Labels
✨ enhancement New feature or request 💡 language Language design #️⃣ syntax Concerns the syntax committee

Comments

@denismerigoux
Copy link
Contributor

It's useful to have a "never" value in the language :

  • as a placeholder for an unimplemented expression ;
  • as an assert false marker for pattern matching cases which you know should not happen ;
  • etc.

Hence, I propose the addition to the language of a "never" value that has the syntactic kind of an expression. It should be polymorphic in type to placehold anything. At execution type, it should behave like an assertion failure.

Concerning the syntax, I propose : impossible (for French and English). But we should discuss this on the next syntax committee :)

@AltGr
Copy link
Contributor

AltGr commented Nov 20, 2024

This would be extremely convenient ; but would certainly shift the balance on how users are constrained into handling all cases. Since they might always resort to defining "dummy" values in any case, this is much better.
(for example, one might write maximum of <list> or if list empty then impossible ; still verbose but explicit on the fact that the case is unhandled)

It may also increase the likeliness of having lazy evaluation diverge from eager evaluation (unless never is made always lazy, but that's probably not a good idea).

Other languages I know of use the following keywords: abort, error, die, panic. Not that these are verbs, which conveys something different compared to never or impossible.
This said, error might actually be good here in my opinion.

@AltGr
Copy link
Contributor

AltGr commented Dec 9, 2024

Forgot to mention this, which might be a better choice: fail (or failure)
In French, in any case, I think échec sounds best.

@AltGr
Copy link
Contributor

AltGr commented Dec 10, 2024

One half of the Syntax Committee says "go with impossible"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request 💡 language Language design #️⃣ syntax Concerns the syntax committee
Projects
Status: Todo
Development

No branches or pull requests

3 participants