[Issue 11946] "need 'this' to access member" when passing field to template parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 29 18:44:27 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11946
--- Comment #28 from Kenji Hara <k.hara.pg at gmail.com> 2014-01-29 18:44:24 PST ---
On the other hand, the purpose of issue 11533 is simple and consistent.
If a module level declaration is moved into function/aggreage scope with
additional 'static' attribute, it should have exactly same behavior.
Examples:
module a;
int var;
void foo();
class C {}
void bar(T)(T) {}
struct S(alias pred) { void f() {} }
void baz(alias v)(T) { v = 1; }
class Test {
static int var;
static void foo();
static class C {}
static void bar(T)(T) {}
static struct S(alias pred) { void f() {} } // New!
static void baz(alias v)(T) { v = 1; } // New!
}
void test() {
static int var;
static void foo();
static class C {}
static void bar(T)(T) {}
static struct S(alias pred) { void f() {} } // New!
static void baz(alias v)(T) { v = 1; } // New!
}
The case of 'S' and 'baz' are newly supported by fixing 11533.
- S(alias pred) will become context-free if 'pred' is context-free.
- baz(alias v) will become context-free if 'v' is context-free.
Indeed, to support baz case current 'static' attribute semantics is made a
little complex, but the introduced behavior is simple, consistent, and easy
understandable.
I think fixiing 11533 is a huge win for the D code locality.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list