BAR
BAR

Reputation: 17111

Using Dot Syntax in Julia

I have seen some code out in the wild that allows us to use dot syntax like so:

function dotTest!(wallet::Wallet, valueToAdd::Int):

...  

end

wallet = Wallet(100)

wallet.dotTest!(5)  # Does not work
dotTest!(wallet, 5)  # Works

However I cannot get it to work, the method is not found because I am not passing wallet as the arg.

So did the language change, or am I doing it wrong?

Upvotes: 0

Views: 579

Answers (1)

Reza Afzalan
Reza Afzalan

Reputation: 5746

As I know, in Julia dot never works like that.
but if you using Lazy then it is possible to write @> wallet dotTest!(5)

A related open discussion here: https://github.com/JuliaLang/julia/issues/5571

Upvotes: 1

Related Questions