Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@bamarsha
Copy link
Contributor

@bamarsha bamarsha commented Oct 27, 2020

This PR makes the parentheses on the left-hand side of a curried call optional, so these are equivalent:

((Foo(x))(y))(z)
Foo(x)(y)(z)

@cgranade
Copy link
Contributor

💕!!!

@msoeken
Copy link
Member

msoeken commented Oct 28, 2020

Will this also work for UDT member access? For example:

let numbers = [Complex(1.0, 2.0), Complex(2.0, 3.0)];
let firstReal = Head(numbers)::Real;

@bamarsha
Copy link
Contributor Author

No, both named and array items must use parentheses:

(Head(numbers))::Real
(Tail(numbers))[0]

@bettinaheim
Copy link
Contributor

bettinaheim commented Oct 28, 2020

@msoeken The choice here is between supporting Adjoint opArray[i] or supporting Head(numbers)::Real since I think that both named item access and numbered item access should have the same precedence (hence we can support either one but not both).

@bamarsha
Copy link
Contributor Author

bamarsha commented Oct 29, 2020

@bettinaheim Would requiring parentheses in Adjoint (opArray[i]) be that bad? Is that more common than Head(numbers)::Real or Tail(numbers)[0]?

@msoeken
Copy link
Member

msoeken commented Oct 29, 2020

Thanks for the additional info @smarsha and @bettinaheim. From my own experience, I tend to add parentheses around Adjoint op and forget them around variables before member or array access.

@bamarsha
Copy link
Contributor Author

Merging this for now since I expect any future changes to the parser related to functors/item access will preserve the repeated call syntax without parentheses.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants