On Fri, Feb 14, 2014 at 3:54 AM, Meta <[email protected]> wrote: > It seems strange that it would choke now, as Cons is a struct. Therefore, > Cons!(Three, ...) should create a new type, and `L: Cons!(a, b), a, b` > shouldn't be any trouble to destructure into two types, `Three` and > `Cons!(Two, ...)`. It had no problem handling the Succ and Number struct > templates I defined.
`alias` is just a bit of syntax sugar, it does not (at least for 2.064) have the same power than fully defining a template and the `is(...)` expression. So yes, D does not have Haskell nice syntax for pattern matching. You can do some pattern matching using templates, but it tends to be a bit heavier than ML/F#/Haskell. (Some would say that at least D does not force you to encode numbers as succ/zero list, since you can use numbers directly as template args, but that's another story).
