Future of memory management in D
JN
666total at wp.pl
Thu Nov 18 15:00:22 UTC 2021
On Thursday, 18 November 2021 at 14:56:40 UTC, rumbu wrote:
>>> * pattern matching on fields/properties
>>
>> How would this work?
>
>
> ```d
> switch (JSONValue)
> {
> case JSONNumber n: writeln ("I have a number %s", n);
> case JSONString s when s.Length > 100 : writeln("long
> string");
> case JSONString s: writeln("short string");
> }
>
> ```
Isn't that just std.sumtype/tagged union?
More information about the Digitalmars-d
mailing list