Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
February 28, 2012 [Issue 7606] New: core.time.TickDuration opCmp accepts only lvalues | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7606 Summary: core.time.TickDuration opCmp accepts only lvalues Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: druntime AssignedTo: nobody@puremagic.com ReportedBy: matejnanut@gmail.com --- Comment #0 from Matej Nanut <matejnanut@gmail.com> 2012-02-28 13:11:53 PST --- Code snippet: import core.time: TickDuration; import std.datetime: StopWatch, AutoStart; void main() { auto wait = TickDuration.from!`msecs`(1000); auto timer = StopWatch(AutoStart.yes); while (timer.peek < wait) // Okay. { } while (wait >= timer.peek) // Compile error. { } } Compiler output: comparison.d(13): Error: function core.time.TickDuration.opCmp (ref const(TickDuration) rhs) const is not callable using argument types (TickDuration) comparison.d(13): Error: timer.peek() is not an lvalue I assume the same thing happens elsewhere in the library. As D strives to be an intuitive language, I reason this to be a bug. "<" and ">=" should work identically in this circumstance. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 28, 2012 [Issue 7606] core.time.TickDuration opCmp accepts only lvalues | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matej Nanut | http://d.puremagic.com/issues/show_bug.cgi?id=7606 Alex Rønne Petersen <xtzgzorex@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xtzgzorex@gmail.com --- Comment #1 from Alex Rønne Petersen <xtzgzorex@gmail.com> 2012-02-28 13:13:53 PST --- What's happening here is that TickDuration's opCmp takes a 'ref' value. This is exactly the reason I *always* avoid ref on op*(), because it creates annoying situations like this one (in fact, I ran into this today as well). I don't know if auto ref would fix this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 28, 2012 [Issue 7606] core.time.TickDuration opCmp accepts only lvalues | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matej Nanut | http://d.puremagic.com/issues/show_bug.cgi?id=7606 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg@gmx.com --- Comment #2 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-02-28 14:13:21 PST --- There's no really no reason for opCmp to take anything other than a straight TickDuration in this case. TickDuration holds 1 long and that's it. It's not particularly large or complicated. In the general case, using auto ref would probably be the correct solution, but auto ref doesn't currently work for non-templated functions, which opCmp obviously isn't. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 14, 2012 [Issue 7606] core.time.TickDuration opCmp accepts only lvalues | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matej Nanut | http://d.puremagic.com/issues/show_bug.cgi?id=7606 --- Comment #4 from github-bugzilla@puremagic.com 2012-03-14 00:37:34 PDT --- Commit pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/67a03aa8061595e5e568ca60aacfa52f75bb155a Updated changelog for issue 7606. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 14, 2012 [Issue 7606] core.time.TickDuration opCmp accepts only lvalues | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matej Nanut | http://d.puremagic.com/issues/show_bug.cgi?id=7606 Jonathan M Davis <jmdavisProg@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation