[MacRuby-devel] Using mixico to streamline HotCocoa?
Ernest N. Prabhakar, Ph.D.
prabhaka at apple.com
Tue Oct 7 13:13:01 PDT 2008
Hi all,
One of the more clunky aspects of Hot Cocoa is the need to repeatedly
state the object being manipulated, e.g.:
slider :frame => [100, 150, 200, 24] do |s|
s.min = 0
s.max = 100
s.on_action do |sender|
puts "Changed to #{sender.doubleValue}!"
end
end
While I appreciate the resulting precision, the repetition feels a bit
Python-esque to me. :-)
My impression was that part of the reason for this was to preserve
"self" instead of using instance_eval, whic h is understandable.
However, _why has come up with a C extension called "mixico" that
provides similar functionalityh via mixins, without changing self:
> http://hackety.org/2008/10/06/mixingOurWayOutOfInstanceEval.html
class Module
def mix_eval mod, &blk
blk.mixin mod
blk.call
blk.mixout mod
end
end
> http://github.com/why/mixico/tree/master/README
What do you think? Is this a viable option for HotCocoa, or are there
other issues I'm overlooking?
-- Ernie P.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-devel/attachments/20081007/a6bd336f/attachment.html
More information about the MacRuby-devel
mailing list