Hi
When i try to instanciate a new Object and have accidentally missed the equal sign
then the Object isn’t instanciated without compiler error (only a warning).
The question for me is what does this statement mean ? Is it treated as a label ?
method Test
var o:Object;
begin
o : new Object; // ← missed equal sign
end;
Trying to instanciate it this way
method Test
begin
var o : new Object; // ← missed equal sign
end;
Maybe ist’s a good idea to forbid also a local variable afterwards to avoid this ?
Due to possible ambiguity with the colon operator, labels cannot prefix a statement that starts with an identifier (such as for example a method call). They can be followed by any keyword-based statement, including a begin/end, or by a semicolon.
Sorry i was not that clear…
The idea is to forbid the same name for a label and a local variable.
So that it’s not possible to declare a local var “o” at the same time/scope as the label “o”