digitalmars.D - Official deprecation dates, -property
- bearophile (26/26) Mar 20 2012 This post is about two partially related topics. It's also related to re...
- bearophile (5/9) Mar 20 2012 Here Jonathan M Davis has reminded me that TDPL asks for this
- Marco Leise (5/17) Mar 30 2012 IIRC a.functionPtrProperty()(); is required to call a function pointer s...
This post is about two partially related topics. It's also related to recent things said by Walter about deprecation and code breakage. I have plenty of D1 code that now and then I port to D2 and I have some old D2 code too that I port to the modern D2 compiler. I have seen that adding the "override" annotations and adding the missing "()" (because I now compile with -wi -property) requires me a short time, and it's kind of mindless work, I don't have to think much about it. On the other hand I need some time to port the usage of the old regex module to the new one, and sometimes it requires a bit of thinking. So I think requiring the "override" annotation (unless -d is used to compile) and deprecating the lack of "()" (unless -d is used to compile) doesn't cause significant problems. In my opinion (based on hundreds of thousands of lines of D1/D2 code written) often small language changes are less painful than Phobos API changes. I have seen similar things in other languages (fixing code to work on Python3 is for me is often less painful than fixing code to adapt it to different libs of to modified API of the the same libs). So I suggest Walter to write down somewhere on the site the date when those two things will become deprecated (the lack of override and ()). We now officially know when DMD1 will stop having bug fixes, so it's right to know when override and () will be enforced, it's a much small thing. - - - - - - - - - - A related thing: If I compile this code (with -wi -property) I get "Error: not a property f.bar": struct Foo { void bar() {} } void main() { Foo f; f.bar; } But this code gives me no errors (compiled with -wi -property): struct Foo { property void bar() {} } void main() { Foo f; f.bar(); } Here I have used () on a property. Currently -property enforces the usage of () on non-properties. But my logic tells me that it should also do the opposite and show an error if you use () with a property method. What do you think? Bye, bearophile
Mar 20 2012
Here I have used () on a property. Currently -property enforces the usage of () on non-properties. But my logic tells me that it should also do the opposite and show an error if you use () with a property method. What do you think?Here Jonathan M Davis has reminded me that TDPL asks for this second part too of the property enforcement: http://d.puremagic.com/issues/show_bug.cgi?id=7723#c4 Bye, bearophile
Mar 20 2012
Am Wed, 21 Mar 2012 03:30:02 +0100 schrieb "bearophile" <bearophileHUGS lycos.com>:IIRC a.functionPtrProperty()(); is required to call a function pointer stored in a property? To me a property is a getter/setter where the setter takes one parameter and the getter has no arguments. By that logic only the syntax without () is required and ambiguities are avoided. (That's me being influenced -- MarcoHere I have used () on a property. Currently -property enforces the usage of () on non-properties. But my logic tells me that it should also do the opposite and show an error if you use () with a property method. What do you think?Here Jonathan M Davis has reminded me that TDPL asks for this second part too of the property enforcement: http://d.puremagic.com/issues/show_bug.cgi?id=7723#c4 Bye, bearophile
Mar 30 2012