[Issue 2740] Template Mixins do not work as advertised

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 19 12:20:50 PST 2011


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


akb825 at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |akb825 at gmail.com


--- Comment #6 from akb825 at gmail.com 2011-02-19 12:18:10 PST ---
(In reply to comment #4)
> Hum, I suspect the code above should not even compile. Instantiating the mixin 
> "is analogous to cutting and pasting the body of the template into the location
> of the mixin." http://www.digitalmars.com/d/2.0/template-mixin.html
> Thus it should be the same as:
> 
> class Foo : IFooable {
>   bool foo() { return false; }
>   bool foo() { return false; }
> }
> 
> 
> which should be a semantic error, I think. See
> http://d.puremagic.com/issues/show_bug.cgi?id=5312

>From http://www.digitalmars.com/d/2.0/template-mixin.html: "The declarations in
a mixin are ‘imported’ into the surrounding scope. If the name of a declaration
in a mixin is the same as a declaration in the surrounding scope, the
surrounding declaration overrides the mixin one." In other words, declarations
in the current scope always hide declarations in the mixin.

-- 
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