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

Support accessing relevant member functions on a wider variety of types #4435

Open
alex-frankel opened this issue Sep 14, 2021 Discussed in #4429 · 4 comments
Open

Support accessing relevant member functions on a wider variety of types #4435

alex-frankel opened this issue Sep 14, 2021 Discussed in #4429 · 4 comments
Labels
enhancement New feature or request

Comments

@alex-frankel
Copy link
Collaborator

alex-frankel commented Sep 14, 2021

The example from the discussion below is for string types, but could be expanded for more:

var length = myArray.length()
var doesContainFoo = myObject.contains('foo')
...

Discussed in #4429

Originally posted by CShen-RACI September 13, 2021
Just my 2 cents, do you guys think it will be better to use program language way to call the function? For example to convert string to upper case, which way is better

upper(rgName)

or
rgName.Upper()

@majastrz
Copy link
Member

I like this quite a bit because it reduces nesting and is much easier to write and reason about:

// contrived example with method syntax
myString.toUpper().toLower().length()

// current syntax
length(toLower(toUpper(myString)))

@anthony-c-martin
Copy link
Member

+1, I like this too.

We'll need to think about what the behavior around completions and validations should look like for the any type, and for invalid types.

@alex-frankel alex-frankel added discussion This is a discussion issue and not a change proposal. enhancement New feature or request labels Sep 15, 2021
@alex-frankel
Copy link
Collaborator Author

Should behave like C# extension methods

@alex-frankel alex-frankel removed discussion This is a discussion issue and not a change proposal. Needs: Triage 🔍 labels Oct 13, 2021
@alex-frankel alex-frankel added this to the Committed Backlog milestone Oct 13, 2021
@anthony-c-martin
Copy link
Member

I discovered this feature has a name! UFCS: https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants