# Allowing the object.method(args...) syntax as an alias for method(object, args ...)

**URL:** <https://discourse.julialang.org/t/allowing-the-object-method-args-syntax-as-an-alias-for-method-object-args/62051>\
**Category:** Internals & Design\
**Tags:** question, design\
**Created:** [May 29, 2021, 5:09pm UTC](https://discourse.julialang.org/t/allowing-the-object-method-args-syntax-as-an-alias-for-method-object-args/62051 "2021-05-29T17:09:54Z")\
**Posts on this page:** 1\
**Showing post:** 198

<div class="post-metadata">

**Author:** ![uniment](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uniment/32/24532_2.png) [@uniment](https://discourse.julialang.org/u/uniment)\
**Post date:** [October 9, 2022, 7:03pm UTC](https://discourse.julialang.org/t/allowing-the-object-method-args-syntax-as-an-alias-for-method-object-args/62051/198 "2022-10-09T19:03:41Z")

</div>

I love the progress we’re making. 😃

To summarize, the current proposal is an infix operator `--` (“dash”) defined as

```julia
--(obj, meth) = (args...; kwargs...) -> meth(obj, args...; kwargs...)

```

which has tighter binding than function calls, and has right-associativity.

We have found that this operator will satisfy the desire to chain operations on an object threaded as a first argument through a sequence of methods,

```julia
my_object--meth1(args1...)--meth2(args2...)--meth3(args3...) ==
    meth3(meth2(meth1(my_object, args1...), args2...), args3...)

```

And, as a happy surprise, it also works well for chaining functions whose first argument is a function

```julia
[1,2,3]--iseven--filter()--sqrt--map() ==
    map(sqrt, filter(iseven, [1,2,3]))

```

This is a much better operator than expected.

Oh, and as a weird bonus, you can also evaluate expressions in Reverse Polish Notation:

```julia
3 -- 4 -- -() -- 5 -- +() == 5 + (4 - 3)

```

The things to work out, it seems, are:

- confirm that we understand it correctly
- check how difficult it would be to implement in the language
- check that broadcasting would work, e.g. `[1, 2, 3]--iseven.() == iseven.([1, 2, 3])`

Thoughts? 💭

---

_[View the full topic](https://discourse.julialang.org/t/allowing-the-object-method-args-syntax-as-an-alias-for-method-object-args/62051)._
