digitalmars.D.bugs - [Issue 2873] New: typeof() for member functions evaluated incorrectly
- d-bugmail puremagic.com (32/32) Apr 21 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2873
- d-bugmail puremagic.com (10/10) May 02 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2873
- d-bugmail puremagic.com (13/13) May 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2873
- d-bugmail puremagic.com (14/14) May 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2873
- d-bugmail puremagic.com (11/17) May 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2873
http://d.puremagic.com/issues/show_bug.cgi?id=2873 Summary: typeof() for member functions evaluated incorrectly Product: D Version: 2.029 Platform: PC OS/Version: Windows Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: dsimcha yahoo.com // Copied/pasted from std.range, added pragma. template hasLength(R) { pragma(msg, typeof(R.init.length).stringof); // (uint())() enum bool hasLength = is(typeof(R.init.length) : ulong); } struct Foo { uint length() { return 0; } } const Foo foo; static assert(hasLength!(Foo)); // Fails. This is pretty serious because it makes important functionality in the new Phobos unusable. However, an easy workaround to fix Phobos until the underlying DMD bug gets fixed is: enum bool hasLength = is(typeof(R.init.length) : ulong) || is(typeof(R.init.length()) : ulong); Also, what the heck is a (uint())() ? --
Apr 21 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2873 Masahiro Nakagawa <repeatedly gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |k-foley onu.edu 10:04:17 PDT --- *** Issue 3508 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: -------
May 02 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2873 Masahiro Nakagawa <repeatedly gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |repeatedly gmail.com Resolution| |INVALID 17:52:04 PDT --- Since adding property, this behavior isn't a bug. length method should be a property. Please use property for length method. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2873 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.cc Masahiro Nakagawa, I am not sure I understand this bug report and your answer well. But if I understand them, then then if you are right, and length method should be a property, then the compiler has to give a compile time error if you try to define a non-property length method, otherwise it's too much easy to write a bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2873 20:33:06 PDT ---Masahiro Nakagawa, I am not sure I understand this bug report and your answer well.Old D's property is a syntactic sugar(member function automatically becomes property), so typeof() should have evaluated .length and .length() correctly. But now, D has property. User can choose property or non-property.But if I understand them, then then if you are right, and length method should be a property, then the compiler has to give a compile time error if you try to define a non-property length method, otherwise it's too much easy to write a bug.I agree because I can't image non-property length. I think D's compiler should print warning message if user tries to define non-property length. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 04 2010