# 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:** 150

<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 7, 2022, 2:21am UTC](https://discourse.julialang.org/t/allowing-the-object-method-args-syntax-as-an-alias-for-method-object-args/62051/150 "2022-10-07T02:21:18Z")

</div>

> [@Benny](#):
>
> Why on earth is this thread still going on about major version-breaking `..` changes or piping that is restricted to single-argument functions when CBOOCall.jl was already suggested in that comment? I don’t like making function names properties of a type in a non-OOP language (which is also why I consider this worse than simply inputting the first argument unusually like do-blocks), but if you’re going to do it, that looks like the way to do it. Only thing I don’t like about that package is that I still can’t tell what CBOO stands for.

Because:

- The intent is _ **not** _ to treat functions as _properties_ of types. This isn’t an OO language!
- What is desired is _ **not** _ piping restricted to single-argument functions. We already have that and it sucks.
- What is being discussed is a language feature to support common thought patterns, _ **not** _ a dozen different libraries and macros that solve the problem in different ways and that will never become a standard.

CBOOCall is hoping to solve a very specific problem: allowing functions or objects with very short names (e.g. `x`, `y`, and `z`) to be conveniently accessed from a module without polluting the global namespace. It’s spiffy, but not what we’re discussing. At least not what I’ve been.

But if we _were_ trying to address that, @jlapeyre could’ve just used Julia’s `let` statement. Using CBOOCall’s example:

```julia
using QCircuit # don't export x, y, and z
let x=QCircuit.x, y=QCircuit.y, z=QCircuit.z
    add!(circ, x, 1)
end

```

This could be more convenient if Julia had some methods for object destructuring… or maybe for broadcasting access of properties, for example

```julia
..(obj, props::Tuple{Vararg{Symbol}}) = getproperty.(Ref(obj), props)
using QCircuit
let (x, y, z) = QCircuit..(:x, :y, :z)
    add!(circ, x, 1)
end

```

Or even, maybe Julia could do something in the same spirit as JavaScript’s `with` statement, to create a block where that namespace applies and outside which it doesn’t… perhaps

```julia
with QCircuit
    add!(circ, x, 1)
end

```

Then any objects and methods of the QCircuit module would be available, but only within that block. I’ve seen some gnarly Julia code where this feature would substantially reduce code complexity and interdependence.

… Anyway, I digress.

> [@Elrod](#):
>
> [Intervals.jl](https://invenia.github.io/Intervals.jl/latest/) is [fairly popular](https://juliahub.com/ui/Packages/Intervals/ihXRn/1.8.0?page=2).

> [@Raf](#):
>
> Actually its [IntervalSets.jl](https://github.com/JuliaMath/IntervalSets.jl) (I always get this mixed up too)

Ah. Unfortunate.

> [@Mason](#):
>
> Nobody is going to break compatability just to make people used to class based OO happy. It’s just not going to happen.

Very well.

I guess `--` isn’t being used for anything. Maybe?

```julia
my_object--mymethod()

```

has a ring to it 🤔

Some other possibilities: `**`, `||`,

(Although I’d prefer `||` to be reserved for an operator with same precedence as addition, but sacrifices must be made)

> [@Raf](#):
>
> Also, mandatory:

> [@PSA: Julia is not at that stage of development anymore](https://discourse.julialang.org/t/psa-julia-is-not-at-that-stage-of-development-anymore/44872/1):
>
> Along with the 1.0 release came a promise: we will not break your working Julia code until Julia 2.0.

We’re already on 1.8… _queue meme of scheming raccoon_

---

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