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

Reply via email to