[Issue 3666] Enhancement Request: Mixin Templates

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Feb 5 13:08:21 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3666


Nick Sabalausky <cbkbbejeap at mailinator.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cbkbbejeap at mailinator.com


--- Comment #1 from Nick Sabalausky <cbkbbejeap at mailinator.com> 2010-02-05 13:08:19 PST ---
A two-part addendum:

1. As D's CTFE improves, there's been more and more reason to generate a string
mixin using CTFE instead of a template. Simen's point that "Most templates that
are made to be mixed in, will not be used in any other way" is also true for
CTFE functions. So this enhancement request should also be extended to CTFE
functions in addition to templates:

-----------------------
mixin string foo2() {
    return "int a;";
}
foo2();
a = 7;
-----------------------

2. It is probably worth noting that this enhancement request can be used to
trivially re-implement the current string mixin:

-----------------------
mixin string mixinString(string str) {
    return str;
}
mixinString("int a;");
-----------------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list