Skip to content

Prefix methods? #17806

@Lumintorious

Description

@Lumintorious

We already have infix methods and we have limited unary operators, I think an option for prefix methods would allow for more expressivity, allowing some methods to behave like keywords and allowing more unary operators.

Use cases:

raise Exception(???)
await Future(???)
reflect IO(???)
assert ???
require ???
not true
print ???
pure ???

I don't know if those should be defined as instance methods or as parametrized methods.
One problem I see with this is differentiating between

f g x = f(g(x))
and
f g x = f.g(x)

If the implementation would be instance methods, a check for whether the first term name f is in scope, if it's in scope then find member f of g x if it's not try looking at member g of f

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