Article: Writing Julia style multiple dispatch code in D
data pulverizer via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Thu Aug 24 18:04:31 PDT 2017
On Friday, 25 August 2017 at 00:35:24 UTC, jmh530 wrote:
> What you seem concerned about here is how to produce a
> meaningful error message for distribution that you do not have
> implementations for. A slightly more elegant solution would be
> to pack the structs into an AliasSeq and then use something
> like !allSatisfies to test them all. I'm sure there's a more
> elegant solution, but that's the first thing I thought of.
>
Andrei suggested allSatisfies that as an alternative approach to
a Union keyword similar to Julia, at the time I was still stuck
on how cool having a Union keyword like Julia's in D would be.
>>
>> immutable class(T...){...}
>
> What you're looking for is an immutable constructor:
>
> class C
> {
> this() immutable;
> }
Aha, thanks!
More information about the Digitalmars-d-announce
mailing list