allow permits keyword for sealed class declarations (and interfaces) #7952
Replies: 4 comments 12 replies
-
the conept could be extended to structs for uniformity. |
Beta Was this translation helpful? Give feedback.
-
Note that the word "sealed" means completely different thing in C#. |
Beta Was this translation helpful? Give feedback.
-
Any updates on this feature? Studying a few months ago I found a case that would like to have this possibility that java offers, but I did not find much information about its equivalent in C# until I found this discussion |
Beta Was this translation helpful? Give feedback.
-
One good thing i found in JEP-409 is about extending StringBuilder. When i need reuse string builder (eg.: some kind of |
Beta Was this translation helpful? Give feedback.
-
Java allows defining sealed classes and interfaces.
With JEP-409 Java introduced the ability to specify exceptions (classes that can actually extend/implement the sealed classes/iterfaces) via permits keyword.
This feature is not that complex and offers quick gains in terms of pattern matching exhaustiveness.
Would this be a relatively easy to implement language feature that would provide quick wins while also avoiding unnecessarily complicating the language syntax?
I know it's a Java feature, but it's good. No worries, Java borrowed from C# lots of recent features so this is actually returning compliments.
PS: I have done a search for similar issues but in case I missed those, feel free to point them out.
Beta Was this translation helpful? Give feedback.
All reactions