Skip to content

Syntax confusion with ** #633

@dronir

Description

@dronir

I was porting some Python code into Julia and forgot to change a Python exponentiation with ** into Julia's ^. I didn't notice this at first and the program ran ok, but was wondering why my results were weird.

After some examination, I realized that even though a**b gives a syntax error in Julia, (a)**(b) with the parenthesis is evaluated as a*b. This is because *(x) is a valid function call and *(x) == x so it's parsed as (a)*(*(b)). Not sure if this needs fixing, but it did cause some confusion, which was largely my own fault for not converting the syntax properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions