Bug 7970 – @property does not properly disambiguate delegate properties

Status
REOPENED
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-22T16:19:41Z
Last change time
2024-12-13T17:59:30Z
Keywords
accepts-invalid, wrong-code
Assigned to
No Owner
Creator
Jonathan M Davis
Moved to GitHub: dmd#17546 →

Comments

Comment #0 by issues.dlang — 2012-04-22T16:19:41Z
This code: import std.stdio; alias void delegate() Callable; class Test { @property Callable a() { return { writeln("hello"); }; } } void main() { auto t = new Test; t.a(); // does NOT say hello t.a()(); // this does } compiles and gives this output hello With -property, the second call to a should be illegal, but it still compiles. And regardless of whether -property is used or not, hello only gets printed once. The first call should call the delegate and print hello, but only the second one is.
Comment #1 by dlang-bugzilla — 2017-07-05T20:45:30Z
-property is gone, so I guess there's nothing to do here...
Comment #2 by destructionator — 2017-07-05T20:47:10Z
I actually don't agree this should be wontfix (though that does seem to be the status quo). We don't have -property, but we do still have @property and this is the one compelling case where I actually want to use it.
Comment #3 by issues.dlang — 2017-07-05T21:21:04Z
(In reply to Adam D. Ruppe from comment #2) > I actually don't agree this should be wontfix (though that does seem to be > the status quo). We don't have -property, but we do still have @property and > this is the one compelling case where I actually want to use it. Agreed. Regardless of -property, without a fix along these lines, the property syntax is somewhat crippled. And @property could still be improved to fix this even if it's unnecessary in most cases that you want to use the property syntax. I am changing this to an enhancement request though rather than simply reopening it.
Comment #4 by dlang-bugzilla — 2017-07-07T06:05:59Z
Wouldn't "fixing" this today be a breaking language change? As far as I understand, such changes now need to go through the DIP process, though if they're going to break code, that's unlikely to go anywhere. Does this issue have a snowball's chance in hell to be fixed? If not, then it's pointless to keep it open.
Comment #5 by issues.dlang — 2017-07-07T14:10:55Z
(In reply to Vladimir Panteleev from comment #4) > Wouldn't "fixing" this today be a breaking language change? > > As far as I understand, such changes now need to go through the DIP process, > though if they're going to break code, that's unlikely to go anywhere. > > Does this issue have a snowball's chance in hell to be fixed? If not, then > it's pointless to keep it open. It's probably the only thing related to @property that _does_ have a chance of being fixed. It does require a DIP though.
Comment #6 by robert.schadek — 2024-12-13T17:59:30Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17546 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB