|
|
|
|
|
by felanthropop
5013 days ago
|
|
But, if trying to eliminate cruft, why include define_singleton_method? Why not just set the proper scope and define_method? Same with instance_eval, class_eval (and module_eval maybe?)- why not just set the scope to define whether you are in instance, class, eigenclass, etc. and use instance_eval? Not a criticism, but a serious question if the goal is to pare it down. |
|
RubyMotion is aiming to be a more complete implementation of Ruby, and one of the core ideas of Ruby is "there's more than one way to do it." Whether you agree or disagree is outside the bounds of RubyMotion and maybe even Ruby IMO; ultimately, whether or not more techniques than scoping define_method are allowed is something that can and should be done a per-project basis.
Food for thought, I found this article detailing all the ways to add singleton methods, in varying levels of grokability: http://wowkhmer.com/2011/01/15/different-ways-to-define-sing...