bearophile wrote:
Ary Borenszweig:

This can be solved if the compiler warns when an assignment is from a variable to the same one.

x = x; // error: assignment has no effect

That's nice in general to have, but I think it's not enough, because if I want 
to assign to an attribute an incremented value:
x = x+1;
What is that x? The attribute or the argument?

class Foo:
  def __init__(self, x):
    x = x + 1

This compiles just fine in pyhtoh.

What is x here? The argument, of course, because that's how it works in python. You forgot to put self before x.

class Foo {
        int x;
        this(int x) {
                x = x + 1;
        }
}
What is x here? The argument, of course, because that's how it works in python. You forgot to put this before x.

How is python safer than D in that sense?

Reply via email to