Reserved word cannot be used in doted unit name

Issue #57 wontfix
markus_ja created an issue

Hello,

when a unit is created which contains a reserved word in it's doted unit name, the compiler doesn't compile.

Syntax Error: Name expected [line: 1, column: 29, file: MyForm.New]

e.g. unit MyForm.New;

This code is from SmartMobileStudio http://forums.smartmobilestudio.com/index.php?/topic/4010-reserved-word-cannot-be-used-in-doted-unit-name/

Comments (3)

  1. Eric Grange repo owner

    Delphi has a similar limitation, though "new" is not a reserved word in Delphi, you cannot have a "begin" in a dotted unit name for instance (nor a "or", "and", etc.)

    I am not sure of what the implication of allowing reserved words would be, I guess in many cases it could be innocuous, but some syntax errors might become more ambiguous. For instance if you have code like

    begin
      a := Classes.
    end;
    

    the error would become that "Classes.end" is an unknown unit or name, rather than an error about the line being incomplete.

  2. Log in to comment