MichaelBenjamin wrote:ruby actually seems to be pretty similar to python in that regard
I find the "fan-boys" who argue about which is better quite comical sometimes - my experience is that, besides syntax details, they're really not much different at all. The main difference when it comes to method definitions is just that in Ruby the "self" is always implied so, like C++, you don't need to write an argument for it or prefix calls to an object's own methods within the class definition.
Even the code-block thing isn't that different, really. It's equivalent to passing a function (function-pointer in C++) as a method argument, except that the function has no name, and some internal optimisation is possible because the anonymous function is unique to a specific call-site.
MichaelBenjamin wrote:how about array/list access? i guess ruby only has a generic list by default
Yes, the Array class is a generic flat list, with a bit of syntax-sugar to allow them to be declared with a literal (e.g.
array = [1, 2, 3, 4]) and to allow the usual square-brackets operators for element look-up and assignment. There also a built in associative array called Hash, which is pretty much the same as a Python Library.
And you guessed right;
animal.size() or
animal.length() would get you the number of animals -though the parentheses are normally omitted for a method with no arguments.
MichaelBenjamin wrote:also regarding flowstone - when is a ruby codebox refreshed/recalculated/recompiled-and-evaluated?
The "compilation" is done literally every time you type a character in the code-editor. It's pretty handy in that you get to see any syntax errors right away, though it does slow down editing for code that's getting to be hundreds of lines. Naturally, it also happens at startup, toobox-dragging, or pasting from the clipboard.
Execution, as you say, is whenever a new input is received. If the Ruby is just plain code without any method definitions, the whole of the code gets executed every time. If you've defined methods, it will try to call the "event" method instead (the "init" method, if you have one, is always called after every "compilation", at the times noted above for that).