Article: Writing Julia style multiple dispatch code in D

data pulverizer via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Fri Aug 25 09:01:27 PDT 2017


On Friday, 25 August 2017 at 14:30:03 UTC, jmh530 wrote:
> On Friday, 25 August 2017 at 01:04:31 UTC, data pulverizer 
> wrote:
>> [snip]
>
> With respect to your point about immutability, you might be 
> interested in the parameterize function in dstats.distrib. I 
> hadn't noticed that was there, but I think it accomplishes, to 
> a limited extent, the behavior of what you want. It returns a 
> delegate with the values of the distribution fixed in there.
>
> Along the same lines, I think below is how I would set it up, 
> rather than the mixin approach I discussed above. While it does 
> not currently work with the parametrize funciton currently, I 
> believe that with some simple adjustments it could.
>
>
> import std.stdio : writeln;
>
> struct Normal
> { ...

Your wrapping strategy looks sensible though I would probably 
generate them all using string mixins.




More information about the Digitalmars-d-announce mailing list