Summary: feature request: static mixin
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from luka8088 <> 2012-10-08 12:43:25 PDT ---
Currently, there is no way of encapsulating mixin templates as static keyword
has no effect.

import std.stdio;

mixin template myTemplate () {
  void fn () {

struct myStruct {
  static mixin myTemplate t1; // static keyword has no effect

void main () {
  myStruct s1;
  s1.t1.fn(); // myTemplate
  s1.fn(); // myTemplate

I would kindly request that static keyword encapsulates the template members so
that s1.fn is not directly accessible but rather only as s1.t1.fn

One hack proposal was to use

static struct t1 {
  mixin myTemplate;

but that turned out to be a bed idea because in that case mixin code can't use
this to access myStruct

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to