[Issue 8161] -property should give an error for invalid property functions
https://issues.dlang.org/show_bug.cgi?id=8161 Jonathan M Davis changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX --- Comment #6 from Jonathan M Davis --- -property is dead, and anything revolving around changing what @property does (which is almost nothing) really needs a DIP. --
[Issue 8161] -property should give an error for invalid property functions
https://issues.dlang.org/show_bug.cgi?id=8161 Nick Treleaven changed: What|Removed |Added Keywords||pull URL||https://github.com/dlang/dm ||d/pull/8320 --
[Issue 8161] -property should give an error for invalid property functions
https://issues.dlang.org/show_bug.cgi?id=8161 Nick Treleavenchanged: What|Removed |Added CC||n...@geany.org --- Comment #5 from Nick Treleaven --- > s.prop = AliasSeq!(1, 2); > I agree that it should be disallowed Yes, because otherwise the restriction to a maximum of 2 arguments doesn't make sense. --
[Issue 8161] -property should give an error for invalid property functions
https://issues.dlang.org/show_bug.cgi?id=8161 bitwisechanged: What|Removed |Added CC||nicolas.jincher...@gmail.co ||m --- Comment #4 from bitwise --- (In reply to Jonathan M Davis from comment #0) > struct S > { > @property void prop(int a, int b) > { > } > } > > It can't possibly be used as a property function either. I'd argue that any > such function should be considered an error as long as it's marked as > @property and the -property flag is used. This works: struct S { @property void prop(int a, int b){} } int main(string[] argv) { S s; s.prop = AliasSeq!(1, 2); return 0; } This behavior is not obvious though, and I agree that it should be disallowed. --
[Issue 8161] -property should give an error for invalid property functions
https://issues.dlang.org/show_bug.cgi?id=8161 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Version|unspecified |D2 --
[Issue 8161] -property should give an error for invalid property functions
http://d.puremagic.com/issues/show_bug.cgi?id=8161 --- Comment #1 from Kenji Hara k.hara...@gmail.com 2012-05-29 23:24:13 PDT --- (In reply to comment #0) This code compiles with -property: struct S { @property void prop() { } } void main() { } It makes no sense that it would. I can agree. Another example would be a function like struct S { @property void prop(int a, int b) { } } It can't possibly be used as a property function either. I'd argue that any such function should be considered an error as long as it's marked as @property and the -property flag is used. A @property function has two parameters is now allowed for UFCS property setter. @property foo(T)(T obj, int val) { ... } void main() { S s; s.foo = 1; // translated to .foo(s, 1), it's valid. } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8161] -property should give an error for invalid property functions
http://d.puremagic.com/issues/show_bug.cgi?id=8161 --- Comment #2 from Jonathan M Davis jmdavisp...@gmx.com 2012-05-29 23:30:30 PDT --- A @property function has two parameters is now allowed for UFCS property setter. @property foo(T)(T obj, int val) { ... } void main() { S s; s.foo = 1; // translated to .foo(s, 1), it's valid. } Yeah, because that's a free function. It's valid to use it as a property, so it makes sense for it to compile with @property. The example that I gave with two arguments was a member function, which already has the invisible this parameter, so it won't work as a property. The point is that any function which cannot be legally used as a property function should not compile when marked with @property and compiled with -property. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8161] -property should give an error for invalid property functions
http://d.puremagic.com/issues/show_bug.cgi?id=8161 --- Comment #3 from Kenji Hara k.hara...@gmail.com 2012-05-29 23:38:53 PDT --- (In reply to comment #2) A @property function has two parameters is now allowed for UFCS property setter. @property foo(T)(T obj, int val) { ... } void main() { S s; s.foo = 1; // translated to .foo(s, 1), it's valid. } Yeah, because that's a free function. It's valid to use it as a property, so it makes sense for it to compile with @property. The example that I gave with two arguments was a member function, which already has the invisible this parameter, so it won't work as a property. The point is that any function which cannot be legally used as a property function should not compile when marked with @property and compiled with -property. OK. I got an understanding. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---