Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow null-aware invocations. #404

Open
lrhn opened this issue Jun 17, 2019 · 2 comments
Open

Allow null-aware invocations. #404

lrhn opened this issue Jun 17, 2019 · 2 comments
Labels
nnbd NNBD related issues state-backlog

Comments

@lrhn
Copy link
Member

lrhn commented Jun 17, 2019

We already plan to allow o?.[v] as a null-aware index operator access (#376).

To complete the selectors, we will also allow o?.(args) and o?.<Types>(args) as null-aware invocations.

The current workaround is to use o?.call(args) and o?.call<Types>(args), which works, but is inconsistent with that we allow o(args) and o<Types>(args) directly. The ?.call(...) workaround is already in common use.

This change modifies the grammar to allow <argumentPart> as a <cascadeSelector> (allowing o..(args) and o?..(args)) and allowing an <argumentPart> after a ?. as well, in whichever way we already modify the grammar to allow ?.[e].
An <argumentPart> is still not an assignable selector.

@eernstg
Copy link
Member

eernstg commented Feb 3, 2020

We will not do this in the first release where nnbd is supported. We have the option to add it later. Adding the 'backlog' label to reflect that this issue is not currently active.

@munificent
Copy link
Member

Probably worth noting that for index operators, we decided to go with ?[] instead of ?.[]. So if we do null-aware invocations, we probably want ?() and ?<T>().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nnbd NNBD related issues state-backlog
Projects
None yet
Development

No branches or pull requests

3 participants