C++ Logo

std-proposals

Advanced search

Re: [std-proposals] A draft for modern switch

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Fri, 23 May 2025 23:57:15 +0200
The question is, what is really needed or missing?  - a general switch case for non-integral or custom data types: will be provided by pattern matching    - a solution specifically for strings, making them first-class citizens and enabling better compiler optimizations? Is it clear, what codepage is string has? Is it clear, what equality means? Sometimes there are different Unicode ways to express the same letters or word, e.g. explicitly putting diacritics on letters or choosing a letter with diacritics.   - a specific solution for strings with fixed number of options and perfect hashing and Tries?   - an grammar for parsing included directly into the language? like in Raku: grammar Enhanced-Paragraph { token TOP { <superword>[ (\s+) <superword>]+ } token superword { <word> | <enhanced-word> } token word { \w+ } token enhanced-word { \* <word> \* } } my $paragraph = "þor is *mighty*"; my $parsed = Enhanced-Paragraph.parse($paragraph); say $parsed; (copied from https://dev.to/jj/introduction-to-grammars-with-perl6-75e)  

Received on 2025-05-23 22:04:54