mixins make the code more ugly and the error messages' line numbers will not be in sync with the code, IIRC. I would like this syntax sugar too.
It's also used in GO, btw. On Wed, May 29, 2013 at 7:52 PM, Diggory <[email protected]> wrote: > On Thursday, 30 May 2013 at 02:51:47 UTC, Diggory wrote: > >> On Thursday, 30 May 2013 at 01:35:58 UTC, MrzlganeE wrote: >> >>> Diggory: That's very cool -- being able to do that in D. Thanks for >>> showing me :) >>> >>> But it is not even a remotely practical solution. >>> The idea is to write less, and so the solution you've given is to >>> write more mixins all over the place. I said I don't even want to write >>> 'auto', I am surely not writing the big mixin chunk. >>> >>> I only gave an example of math stuff. >>> But I'd use := for the non-math stuff too. >>> >>> I want := it to be available everywhere. >>> Even if I am just typing a snippet into dpaste. >>> >>> If D implements this, C++ will try to copy it 10 years later. >>> It's a futuristic thing -- what is old is new. >>> >> >> The mixin definition only needs to exist once, and you can use "mixin" >> anywhere - you could wrap an entire source file in it: >> >> mixin!q{ >> >> /* All of your code */ >> >> } >> > > *mixin Math!q{ ... }; >
