-
Notifications
You must be signed in to change notification settings - Fork 32
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
warning: OpenStruct#define_singleton_method accesses caller method's state and should not be aliased #40
Comments
I'm sorry, I'll report an Issue to Jruby as I think it's a JRuby problem. |
I'll reopen, I imagine this is related to #30 |
@marcandre This is the same issue for a couple other methods. I'm not sure why they were not reported before.
In the short term, though, these should probably be blacklisted for aliasing or overwriting, as they are part of the core plumbing of types and method calls. |
Hmm, except that I actually use
I'm not sure of the technical details, but isn't |
The problem is not the new name, it's that the old name is associated with a method that has special access to the caller frame. We know The warning is because we do not necessarily know if we have already compiled code without a frame that calls
It is, and both require access to the caller's frame to get the current visibility. |
My point is I don't understand why I'm even more confused now that you say that Final confusion: doesn't |
Hmmm, that may be the case. We implement
Are you aliasing it? It is defined on Module, not Object, so I would assume OpenStruct does not alias it. Also, why are you aliasing the private method |
It does seem to be the case that |
Ugh, no, you're right of course. So, in summary:
Alternative to 2 would be for |
Confirmed! I will deal with the |
PR ready |
Back to work this morning and I will look into the define_singleton_method visibility thing to confirm. |
I have asked for clarification on ruby-core slack, but I think the answer is that since Assuming this was the intent, I will push for documenting and specifying this in CRuby and rubyspec. |
Yes, that's my understanding too. Thanks 👍 |
I've pushed jruby/jruby#7055 which makes public visibility the only visibility for
I don't like breaking the one edge case I found without full buy-in from ruby-core, though...
Edit: fixed issue link |
Right, similarly
Feels very odd to me. |
See https://bugs.ruby-lang.org/issues/18561 for my CRuby issue to codify this behavior of |
Much better example of an edge case, and one we might actually see in practice (though I highly doubt anyone would expect it to have different behavior than the unmatched-scoping case). |
@marcandre Not getting much buy-in for the edge-case fix, so I'm unsure how to proceed. We'd like to have a version of ostruct that does not warn, and I am reluctant to merge the explicit PUBLIC change into JRuby 9.3.4 without some acknowledgement from other ruby-core folks. |
Understood. I guess I'll change the code to use |
Just so you are aware, that will of course have effectively the same result as my JRuby PR, since the |
@marcandre After some team discussion, and some analysis and buy-in from @jeremyevans (https://bugs.ruby-lang.org/issues/18561, ruby/ruby#5636), we have decided to go ahead with the change in 9.3.4 (jruby/jruby#7055). |
Perfect, thanks. So avoiding only |
Correct! |
Thanks for the reminder! Released from Lisboa as 0.5.4 :-) |
Thank you @marcandre! |
JRuby emits the warning: ObjectMethods#method accesses caller method's state and should not be aliased. see ruby/ostruct#40 for a discussion about why JRuby emits this warning. We suppress the warning by extending Warning to ignore the message.
JRuby emits the warning: ObjectMethods#method accesses caller method's state and should not be aliased. see ruby/ostruct#40 for a discussion about why JRuby emits this warning. We suppress the warning by extending Warning to ignore the message.
JRuby emits the warning: ObjectMethods#method accesses caller method's state and should not be aliased. see ruby/ostruct#40 for a discussion about why JRuby emits this warning. We suppress the warning by extending Warning to ignore the message.
JRuby emits the warning: ObjectMethods#method accesses caller method's state and should not be aliased. see ruby/ostruct#40 for a discussion about why JRuby emits this warning. We suppress the warning by extending Warning to ignore the message.
JRuby emits the warning: ObjectMethods#method accesses caller method's state and should not be aliased. see ruby/ostruct#40 for a discussion about why JRuby emits this warning. We suppress the warning by extending Warning to ignore the message.
JRuby emits the warning: ObjectMethods#method accesses caller method's state and should not be aliased. see ruby/ostruct#40 for a discussion about why JRuby emits this warning. We suppress the warning by extending Warning to ignore the message.
JRuby emits the warning: ObjectMethods#method accesses caller method's state and should not be aliased. see ruby/ostruct#40 for a discussion about why JRuby emits this warning. We suppress the warning by extending Warning to ignore the message.
jruby 9.3.3.0 now shows the following warning.
It did not show up in jruby 9.3.2.0.
The text was updated successfully, but these errors were encountered: