-
-
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
rename ref etc. to something less likely to conflict #1484
Comments
That example is a bit troubling when it comes to namespace isolation. Normally, I would expect that in a namespace I create myself, I will be able to (re)define the names of anything that I don't import and explicitly use from another namespace. Of course, the code does use On the other hand, you want to be able to overload
that you should not redefine unless you really know what you are doing. (Are there others that might get called in the current scope without appearing in the source?) I have no idea how this should best be handled. |
One thing I can do is make |
Perhaps that behavior should be the default? E.g. if I have Another way of saying this is that perhaps we should have code located in a module search that module for a binding first, and then move outward. This would be similar to the idea of "scope" discussed in #1342 |
In this situation (at the prompt), we are in Main, not Base. So what you're describing is in fact happening: after |
I think I was misunderstanding the boundary between parser and standard library. I was assuming that somewhere in |
@JeffBezanson: I thought about making it mean |
Yes, The argument I can think of for making it |
Hmm, that does pose a problem, doesn't it, because as @toivoh states above, if I then have a module Is this a result of the fact that we don't have a |
We don't have operators at all, only function names and syntax for them. Maybe it just needs to be renamed to something less likely to be used, like |
I guess the reason this seems strange to me is that I'm still thinking in an "Object-Oriented C++" way, where data and functionality is tied together. E.g. I feel that since the data is a String, which is defined in |
You seem to be confusing calling |
I think that's the whole problem; that it is possible for these two to be confused. The issue that we really should be talking about (My rambling about object-orientedness notwithstanding) is the fact that it's surprising to users that Ideally, I think it'd be most transparent to have a function called
Something like that is probably much easier to figure out what is going on for a user, and "fits in" with the definitions of other overloadable syntax like I realize this syntax might be really messy to implement, so I'm willing to agree that something like |
Correct, the problem is simply that I'm all in favor of a rename if we can figure out a good one. It turns out |
I haven't felt that I've had anything useful to add to the discussion until now, but how about using (It might have been obvious, but |
Yes, making We will probably have to do something like the underscore convention. Best thing to do with |
Yeap, you're totally right. Having |
consistently wrap all calls generated by the front end in (top ). this makes them behave like macros defined in Base, which is reasonable. related to #1484. this at least prevents such collisions for now, but it may not be the final behavior we settle on. we may want some names (like ref) evaluated in the context where they occur.
This can probably be closed. The current situation isn't perfect (one can't |
The other thing that scares me is that we should technically rename |
@kmsquire: I don't think that it's just |
Of course, sorry, wasn't clear. The original issue was that I used |
Which is only true if you try to use ref in global scope. So maybe it's actually fine... Nothing to see here... move along... I'm going to close this. |
I changed |
Interactive use is also an issue. If I changed |
Okay, I'll leave it then. |
I just got bit by redefining
ref
as a string:The text was updated successfully, but these errors were encountered: