Skip to content

Parenthesis Postfix Function Syntax Allowing (x,y)f #38704

@jessebett

Description

@jessebett

This issue is to discuss the possible advantages and disadvantages for allowing a postfix function call syntax where the function name appears after the closing parenthesis.
i.e. (x)f or (x,y)f

I think this notation has merit because it maintains the relationship between parenthesis() and function calling.

Recall that, by definition, Tuples are an abstraction containing the arguments of a yet unspecified function: (x,y).
f(x,y) gives the syntax to call the function f on the tuple of arguments.

I propose we extend that intuition to also allow (x,y)f to be valid syntax for function calling.

Right now it is not valid syntax. Further, (x)f is parsed as juxtaposition, so *. This causes f(x) to behave completely differently from (x)f. I don't think that is ideal either.

We would have to resolve some ambiguities e.g. f(x)g and (f)(g).

Are there obvious problems with allowing this beyond aesthetic discomfort?

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingThis change will break code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions