Option types and pattern matching.
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Mon Oct 26 02:16:05 PDT 2015
On 2015-10-25 19:23, Dmitry Olshansky wrote:
> I humbly believe that D may just add special re-write rule to the switch
> statement in order to allow user-defined switchable types. This goes
> along nicely with the trend - e.g. foreach statement works with anything
> having static range interfaces or opApply.
Do you think that could handle all different type of patterns? For
example extractor patterns:
match x {
case Foo(bar) => println(bar)
}
The above is Scala.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list