Eliminating code duplication for static/nonstatic functions

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Sep 20 08:13:45 PDT 2013


On 9/19/13 9:59 PM, safety0ff wrote:
> On Thursday, 19 September 2013 at 17:20:53 UTC, Andrej Mitrovic wrote:
>> On Thursday, 19 September 2013 at 17:10:43 UTC, Andrei Alexandrescu
>> wrote:
>>> Any ideas for a clean solution? I can't get much further than string
>>> mixins, which wouldn't be clean :o).
>>
>> opDispatch comes to mind. You'd only need two of them, one marked
>> static and the other one not.
>
> Hello,
>
> I decided to try and solve this as an exercise with the opDispatch hint
> above.
>
> I am not very experienced with D, but I am sharing my solution anyway in
> case it is of interest: http://dpaste.dzfl.pl/3bde7db1
>
> Enjoy/Destroy :)

Nice. If that's what you write while not being very experienced, I'm 
really looking forward to what you'll write when you'll be!


Thanks,

Andrei



More information about the Digitalmars-d mailing list