-
Notifications
You must be signed in to change notification settings - Fork 66
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 TypeOf Many. #93
base: main
Are you sure you want to change the base?
Proposal TypeOf Many. #93
Conversation
82cf8a1
to
c0c0dfa
Compare
c0c0dfa
to
58c2222
Compare
@AnthonyDGreen |
Using Linq Extension for lower it as For OrElse If {GetType(T0), GetType(T1)}.Any(Function(t) t Is obj.GetType()) Then
End If For AndAlso If {GetType(T0), GetType(T1)}.All(Function(t) t Is obj.GetType()) Then
End If |
@xieguigang I don't think using LINQ would be the best target for the lowering, as isn't a direct translation of the intended syntactic sugar. |
|
@bandleader I'll dig out the issue / proposal and update the first post. Noted, It also not a good implementation to use for this feature proposal. I think there is too much "machinery" involved. The proposal should generate the same code to start with, plus it gives us the option to use different approach for larger number of types to match against. eg Embedded dictionary lookup, like what is used for same As for as I can ascertain pattern-matching may not be part of the road map. Though there ideas / proposals to extend the capabilities of This proposal was targeting a very specific use case, simplifying multiple types checks, that follow the pattern |
@AdamSpeight2008 That's what I meant by pattern matching. If we do an |
@AdamSpeight2008 The first step in designing a language feature is to open an issue on the |
@bandleader Do we need pattern matching? Even if all we implemented was composable types, wouldn't that be enough? |
@zspitz No; there are tons of things that pattern matching can do (and does do in other languages) apart from checking types. To be clear, your idea is very valuable and the use case is common. I'm just saying that it will anyway be implemented as part of pattern matching, and therefore, I'm not sure if the language team will want to additionally implement it in the |
Prefer Proposal #481 |
Initial work on the proposal TypeOf Many.
Edit See Issue / Proposal