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

Introduce case statements independently of type annotations #223

Closed
masak opened this issue Feb 6, 2017 · 2 comments
Closed

Introduce case statements independently of type annotations #223

masak opened this issue Feb 6, 2017 · 2 comments

Comments

@masak
Copy link
Owner

masak commented Feb 6, 2017

It strikes me that we could perhaps eliminate NoneType and have Maybe<T> even without all of #33. (I was inspired by @raiph in thinking in this direction.)

The premise is this:

  • None and NoneType are gone.
  • Whenever you want to allow for a None-like value, you give something the type Maybe<Expr> or similar. On the Perl 6 level.
  • We implement case statements à la Implement ADTs, and pattern matching #34.
  • But without any type annotations and type inference switched on, these switch statements are mostly just syntax; they're a way to dig into a Maybe, but they don't come with any strictures. (No totality checking; no checking the cases against the surrounding type.)

I should add that this would be an experiment, to see if we like it better than the current None status quo. There is promise in the idea; it would for example address the concerns raised in #148, too.

@masak
Copy link
Owner Author

masak commented Dec 17, 2018

I liked pampy, which provides a pretty neat library-only way to pattern match. We could try porting it to 007 and see how it looks; it might be a sensible step on the way to doing pattern matching with syntax.

@masak
Copy link
Owner Author

masak commented Apr 23, 2019

I'm going to close this one; I find I don't believe strongly in getting rid of none these days. (Also, TypeScript sort of shows that it's not super-necessary either.)

@masak masak closed this as completed Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant