digitalmars.D.bugs - [Issue 4675] New: Eponymous Template should hide internal names
- d-bugmail puremagic.com (37/37) Aug 18 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4675
- d-bugmail puremagic.com (31/33) Aug 20 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4675
- d-bugmail puremagic.com (11/11) Aug 20 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4675
- d-bugmail puremagic.com (11/11) Aug 20 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4675
- d-bugmail puremagic.com (20/20) Aug 27 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4675
- d-bugmail puremagic.com (12/12) Dec 31 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4675
- d-bugmail puremagic.com (12/12) Jan 15 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4675
- d-bugmail puremagic.com (6/6) Jan 22 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4675
- d-bugmail puremagic.com (10/10) Jan 24 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4675
http://d.puremagic.com/issues/show_bug.cgi?id=4675 Summary: Eponymous Template should hide internal names Product: D Version: D2 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 13:19:16 PDT --- Code: import std.stdio; void main() { } template isNumeric(T) { enum bool test1 = is(T : long); // should be hidden enum bool test2 = is(T : real); // should be hidden enum bool isNumeric = test1 || test2; } unittest { static assert(isNumeric!(int).test1); // should be an error writeln(isNumeric!(int).test1); // should be an error, but writes true writeln(isNumeric!(int).test2); // should be an error, but writes true } According to TDPL, calling isNumeric!(T) is rewritten by the compiler to isNumeric!(T).isNumeric, therefore hiding access to any other names. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 18 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4675 Torarin <torarin gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |torarin gmail.com I ran into trouble with this example as well, but this time because what should work, doesn't: import std.stdio; template isNumeric(T) { enum bool test1 = is(T : long); enum bool test2 = is(T : real); enum bool isNumeric = test1 || test2; } void main() { bool a = isNumeric!int; } Fails with: test.d(12): Error: expression isNumeric!(int) is void and has no value. I was surprised to find that the language reference actually contradicts TDPL here: "Implicit Template Properties If a template has exactly one member in it, and the name of that member is the same as the template name, that member is assumed to be referred to in a template instantiation."According to TDPL, calling isNumeric!(T) is rewritten by the compiler to isNumeric!(T).isNumeric, therefore hiding access to any other names.-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 20 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4675 17:35:05 PDT --- There are more cases of contradiction, but I think this has to do with some of the spec not being updated. In other cases some features are simply not yet implemented.. My guess is that this feature should be implemented like it states in TDPL. Otherwise for any non-trivial templates you would have to write code like: isNumeric!(int).isNumeric -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 20 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4675 Yes. std.traits deals with it by doing private template hasRawAliasing(T...) { enum hasRawAliasing = hasRawPointerImpl!(RepresentationTypeTuple!(T)).result; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 20 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4675 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc Time ago some people have proposed to allow "private" for that purpose: template isNumeric(T) { private enum bool test1 = is(T : long); private enum bool test2 = is(T : real); enum bool isNumeric = test1 || test2; } This is good because the person that reads the code doesn't need to remember the rule that test1 and test2 become invisible if isNumeric is defined inside isNumeric(). So I think this is a more tidy solution to the problem. On the other hand you want all names to be private but the one that is eponymous, so the solution in TDPL is shorter (and probably acceptable still). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 27 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4675 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch https://github.com/D-Programming-Language/dmd/pull/590 Eponymous member always hides other members (do not consider access attributes). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 31 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4675 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED 19:17:09 PST --- https://github.com/D-Programming-Language/dmd/commit/91facb7b443bb61793b045fab9715be633f1aa99 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 15 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4675 *** Issue 2640 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 22 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4675 Denis <verylonglogin.reg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |verylonglogin.reg gmail.com --- Still doesn't work in most real-life (Phobos) cases. Filled Issue 7363. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 24 2012