-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
remove importall Base.Operators #8113
Comments
I'd be OK with this. It feels like "magic", and thats often a bad sign |
On my first read of the docs (modules), I was bugged by the explanation: "since one typically wants to extend operators rather than creating entirely new definitions of them". It seems arbitrary, and doesn't help understand what makes them special (e.g. could I want entirely new definitions of |
+1. When I read the mailing list post I also did not fine it very obvious. |
+1 |
I agree that this doesn't feel great. But I also think that adding methods to imported functions feels odd in general. That was what I was trying to address with part of my interfaces proposal. Since I feel like something is wrong here in general, I'm reluctant to fiddle around with this too much until we have a story around this that just feels right. |
I'd agree with @StefanKarpinski, both approaches are unintuitive in some sense. Switching between them without a real solution will cause a lot of churn. |
I've also always felt that this is a bit arbitrary, but I don't have the answer either. All I can say is that some names really are more canonical than others. Having your own |
I opened this because I had the sense that it unusual because it is unnecessarily complicated, not that it is actually unusual. I would argue that wanting your own getindex or start method is far more unusual, and yet that doesn't have this hidden special case code. |
|
I agree that colon, hcat, vcat, getindex, setindex!, transpose, ctranspose correspond to special syntax. But this why didn't
@StefanKarpinski the following deserve's it's own Julep, but I'll try to outline this here to see if others think it is worthwhile: I've previously mentioned / asked for module Me
let . = Base
.+(a::MyType,b::MyType) = 1
..+(a::MyType,B::MyType) = 2
global +(a,b) = .+(a,b)
global .+(a,b) = ..+(a,b)
end This requires a change to the parsing rules for Note, that this also makes it much easier to refer to qualified infix operators, because the dot parsing can be defined to be unambiguous. |
=== cannot have methods added so it doesn't really matter. The A_mul_B
|
also that it is missing any operator defined since v0.2 |
But that's precisely why importing === is not useful. All it would do is |
That sounds like a great argument, except that (a) that's not what julia does if you importall undefined operators (b) we have undefined operators in the list |
Just as another argument for @wbhart has the flint interpreter and there was an issue relating to his redefinition of Though I am quite new at using Julia, so there may be a way of only using redefined operators in specific sections of code I have not found yet! |
If this issue is accepted, then it will be easy to redefine an operator within any |
All operators are normal identifiers that can also be used as local |
I think we should do this. The compatibility story couldn't be easier: just add |
Seems reasonable to me. The current situation means you can't actually define your own operators. |
+1 (again)
|
One possible exception: Either that or we need to adopt the proposal in #11452. |
I'm still not sure but @vtjnash's proposal has something appealing about it. I have yet to come up with a really convincing argument that makes it a slam dunk for me though. |
The basic problem is that it extends our data model at a very low level, with an operation |
it's rather annoying that
importall Base.Operators
is the default. It came up recently on the mailing list, but also came up recently in my own work. The workaround (baremodule), requires a lot of boilerplate (and some likeeval
is rather mysterious). The need for workarounds also make it difficult to use the redefined function outside of the module (via export).The text was updated successfully, but these errors were encountered: