-
Notifications
You must be signed in to change notification settings - Fork 8
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
Too much #eval of strings #6
Comments
Took care of lib/hotcocoa/mapper.rb:220 |
Took care of hotcocoa/mappings/appkit/color.rb:4 |
Took care of hotcocoa/mappings/appkit/font.rb:34 |
I think for hotcocoa/delegate_builder.rb:57 we can only make the code inside of eval smaller, but because of the delegation mechanics we cannot completely remove it. |
Took care of hotcocoa/mapping_methods:107 |
Hey, I'm curious if you're OK with methods like Module#define_method which can use module_eval under the covers. Or is it just evaling strings that you want to minimize in HotCocoa? |
@isaac yes, it is the eval'ing of strings that I want to minimize, Module#define_method is, I think, the suitable replacement in most cases, especially where #module_eval is being called just to define a method. |
I've adjusted the bug to better reflect what I meant. Thanks for pointing that out, @isaac |
mapper.rb:59 is not changeable |
mapper.rb:179 and mapper.rb:189 are now taken care of mapper.rb:179 has an odd looking solution, it is a workaround to a small issue I was having with MacRuby, not sure if it is a MacRuby bug or not |
The only cases left are: delegate_builder.rb:57 This one is kind of important since it is used by every delegate that is set up using Hot Cocoa style delegation. Though, we can only reduce the amount of code that needs to be evaluated as a string. mvc.rb:140 Not too big a deal right now. I haven't even gotten around to really looking at the file yet and it has to be explicitly loaded. No examples use this, and it had a syntax issue that was not discovered until we tried compiling the file. |
The reason for the workaround has been discovered to be a MacRuby bug. See MacRuby Ticket #1371. |
There is entirely too much use of #eval (and close family) of strings in HotCocoa, which leaks memory in MacRuby and is slower than alternatives. In some cases it is inappropriate given the meta-programming hooks available in Ruby 1.9, in other cases we can refactor to get rid of it.
The text was updated successfully, but these errors were encountered: