Skip to content

Is There a Way to Panic or Cause Undefined Behavior and Skip the Type Checking? #1542

Answered by bugarela
zicklag asked this question in Q&A
Discussion options

You must be logged in to vote

There's currently nothing like that in the language and I'm trying to be careful with it, as this is a specification language and it should incentivize people to define what happens in every single scenario. However, I know that some scenarios are just obviously impossible and it's annoying to have to handle them. Therefore, I plan to really soon add unwrap() to the language (which takes an option type and causes undefined behavior/error when called on None).

Since I haven't implemented that yet, I'll give you a version I'm using in the meantime that works but is quite hacky. Please use it with discretion 😬

  pure def unwrap(value: Option[a]): a = {
    match value {
      | None => Map().…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zicklag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants