mixin extension

Stewart Gordon smjg_1998 at yahoo.com
Thu May 4 05:55:38 PDT 2006


Matthias Spycher wrote:
> Here's an idea to extend mixins in a manner that would allow you to mix 
> code around a block in D.
> 
> If you had:
> 
> template Trace(f:char[])
> {
>   printf("Entering %s", f);
> }
> {
>   printf("Exiting %s", f);
> }
> 
> Note the two blocks associated with a single template declaration. You 
> might mix code around a third block with:
<snip>

A template in D is a collection of declarations.  The idea of 
overloading them like this doesn't really make sense to me.

Besides, I can imagine it being difficult to parse, possibly even 
ambiguous, if you have to worry about whether each template has one or 
two bodies.

But the concept of reusable in/out blocks isn't a bad one.  We could 
have it, but we should think a bit about the notation.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.



More information about the Digitalmars-d mailing list