What is the proper way to outline static-if-conditions ?
chrehme at gmx.de
Sun Oct 10 16:12:27 UTC 2021
On Sunday, 10 October 2021 at 15:15:51 UTC, drug wrote:
>> It would be nice if one could use pattern-matching for it in
>> D. Is this possible?
> As I know it's impossible, but you can use a regular template:
If anyone is interested in pattern matching, someone provides a
package "dpmatch" which uses PEG (some parsing grammer which is
implemented in D) to achieve Haskel-style pattern matching, yet
for sum-type definitions only. And they use GC + interfaces.
Hence it cannot be used with BetterC.
Sumtypes can also be created with the `sumtype` package which
uses D's delegate literals for pattern matching.
More information about the Digitalmars-d-learn