Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: allow more update operators, e.g. a ⊗= 2 as shorthand for a = a ⊗ 2 #15964

Open
carlobaldassi opened this issue Apr 20, 2016 · 7 comments
Assignees
Labels
parser Language parsing and surface syntax

Comments

@carlobaldassi
Copy link
Member

Only a subset of available operators allow the shorthand OPERATOR= notation. I think the current situation is that only ASCII operators are covered.
e.g.

julia> a ×= b
ERROR: syntax: unexpected "="
 in eval(::Module, ::Any) at ./boot.jl:236

I think it would be reasonable if all operators which allow binary infix syntax would also allow the shorthand. (This came up when I defined a custom operator.)

@carlobaldassi carlobaldassi added the parser Language parsing and surface syntax label Apr 20, 2016
@TotalVerb
Copy link
Contributor

I think comparison operators should not be included, for consistency. After all, a >= b does not mean a = a > b.

@Sisyphuss
Copy link

It is always simple to define some more update operator. But the true question is whether they are in-place?

@StefanKarpinski
Copy link
Member

Not the place, @Sisyphuss.

@StefanKarpinski
Copy link
Member

This seems like a reasonable proposal to me – shall I mark it as accepted, @JeffBezanson?

@JeffBezanson
Copy link
Member

Yes.

@Sacha0
Copy link
Member

Sacha0 commented Dec 22, 2016

Not release blocking. Best!

@Sacha0 Sacha0 removed this from the 0.6.0 milestone Dec 22, 2016
@stevengj stevengj changed the title Feature request: allow more update operators, e.g. a ⊗= 2 as sorthand for a = a ⊗ 2 Feature request: allow more update operators, e.g. a ⊗= 2 as shorthand for a = a ⊗ 2 Dec 22, 2016
@chakravala
Copy link
Contributor

This feature would make sense because there is no situation in Julia where an operator immediately followed by an equal sign makes sense, except as an updating operator.

For example, ∪= could never make sense as anything but an updating operator. Since that is the case, it makes total sense to have the language support this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser Language parsing and surface syntax
Projects
None yet
Development

No branches or pull requests

8 participants