-
Notifications
You must be signed in to change notification settings - Fork 19
Shoes is not Ruby
The tag line for Shoes is "Nobody Knows Shoes" which is a reference to the whimsical introduction of Shoes for beginners. A classic all should read even if its a bit out of date.
I have another saying: "Shoes is not Ruby, it only looks like Ruby". Both are whimsically true. Folks who know a lot about Ruby stumble on a few things because they expect that Shoes is just another bit of Ruby code and classes and modules along with some 'C' extensions and gems. Sorry, but that's not how Shoes works.
There's a section in the Shoes Manual that talks about self. It's much better if you read it from your copy of Shoes so you can run the little code snippets and say "I guess that makes sense". Then a few months later, you'll stumble on to something that just isn't the way you think things should work and you end up reading this. Twice. Probably more than twice.
This a big deal if you expect Shoes to behave to your meta-programming point of view. Shoes 3.x is written in C that calls Ruby C api's. C code that doesn't really support run time introspection of classes and methods nor can you change them. If you monkey patch a method or subclass a C defined class it might work if called from Ruby but you have no guarantee that any internal C calls to that method or class will respect your changes.
Once again. Shoes 3 is written in C and has it own statically defined class/module layout at the root. You can not change that static structure from Ruby code.
Shoes (re)defines self according to the static (C) rules that define Shoes. That makes Shoes an approachable GUI written in (almost) Ruby. It does not mean Shoes can do anything Ruby can do. Nor does it adhere to some flexible definition of what the Ruby way is. There's many thousands of lines of C code to rewrite if you want to flex things your way.
Someone recently said: It seems to be both a design feature and a design flaw.
Ruby is a flexible language. Like a rope that you can twist into any shape you want. Shoes is a short steel pipe with a Ruby rope attached at one end. Feel free to ignore the whip image and speculation about which end controls the other.
Perhaps you've heard this Buddhist story - the master asks you to extend your arm and with your thumb block the moon from your sight. When you succeed, he says "The finger is not the moon". Pretty damn clever those old Buddhists.
"Master is tricksy" -- Gollum
Shoes is not Ruby