Skip to content

Parse 1 + 2 + 3 as +(1, +(2, 3)) #34999

@vchuravy

Description

@vchuravy

@ChrisRackauckas and I was just talking and we were wondering why we are parsing 1 + 2 + 3 as Expr(:+, 1, 2, 3).
While I can see how that makes the parsers job easier it seems to make it harder for type-inference since instead of just
having on + method for integers we now have ~16, added to that is Chris infamous tendencies to create very long expressions
which causes things to break down one you reach a limit. (and as demonstrated before no matter how large N at some point it will be to small).

Is there a strong reason that I am missing for why we keep parsing it as a single expression? Macro-writers already need to program defensively
against both forms and it seems to me normalizing earlier would be better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingThis change will break codeparserLanguage parsing and surface syntaxspeculativeWhether the change will be implemented is speculative

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions