COMMUNITY

Error when a comment breaks code. Is it a bug or feature?

class Test 
{
    static function main() 
    {
        Test./*comment*/foo();  //Error: Unexpected foo
    }
    
    static function foo()
    {
        trace("foo");
    }
}

Should work if the dot is after the comment

Yep, but the question is still actual. Should comments be ignored in any place?

Don’t think so. I don’t think any language will allow cla/**/ss or func/**/tion

For example, Test./*comment*/foo(); works fine in typescript/js.

There are a ton of things that works in TS but not in Haxe, and vice versa.

At the end, I think it is neither a bug nor feature. It is just how the Haxe parser works right now.

It sure looks to be a bug, so it’d be best to just report it. If there’s a reason why this doesn’t work, it will be given.

Thanks. Done. https://github.com/HaxeFoundation/haxe/issues/9886
Simon’s reaction is lightning fast. It’s not a bug.