question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[@gavinking] We still don’t have any real plans to support genuine pattern matching, however one small thing that could I guess make some sense would be to allow tuple expressions in a case, for example:

switch(tuple)
case ([0,false]) { ... }
case ([1,true]) { ... }
case ([1,false]) { ... }
else { ... }

This would only be for tuples of types that we already allow in cases.

[Migrated from ceylon/ceylon-spec#1021]

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:57 (47 by maintainers)

github_iconTop GitHub Comments

2reactions
gavinkingcommented, Oct 17, 2016

I think it would be weird and irregular to not allow case([]).

0reactions
gavinkingcommented, Oct 18, 2016

=== is fine, I guess.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use c# tuple value types in a switch statement
You can't use a tuple as a switch value, switch only accepts constant values. – Gusman. Jun 4, 2017 at 15:27. @Gusman Not ......
Read more >
Do more with patterns in C# 8.0 - .NET Blog
A very useful special case of positional patterns is when they are applied to tuples. If a switch statement is applied to a...
Read more >
Tuples and Switch Statements in Swift Programming Language
Tuples can also be used in Switch statement, either by themselves (normal equality check), or along with underscores and where clauses to construct...
Read more >
Switches on tuple values - Swift - Java2s.com
When writing a tuple switch you'll require a default case. Related Topic. Switches · Switches with range · Switches without break · Switches...
Read more >
Working With Switch Expressions And Pattern Matching In C# ...
As you can see in the above code the tuple value is being compared and the expression of matching tuple value is being...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found