Re: Ruby (learning and language comparisons)
Posted: Sat Mar 07, 2020 8:19 pm
.
DSP Robotics and FlowStone Graphical Programming Software Support and Forums
https://dsprobotics.com/support/
In the way I used it, it's not an operator - it is literally just part of the method name, as tulamide said. Method names can also end with the '!' character (usually meaning "watch out, this method is potentially dangerous").MichaelBenjamin wrote:i guess the ? operator still eludes me
Yes, the only difference between the two is in the scopes for name lookup. Code boxes are able to see variable and method names of the enclosing scope, in much the same way that Python can have function definitions within the body of a method which do the same thing.MichaelBenjamin wrote:so i guess this also applies to FS ruby codeboxes
As far as I can see, yes. The only slight fly in the ointment is that "class" would override the built-in method for reading an object's class, so is usually avoided; but I don't think it would do any harm in practice (the "kind_of?" method would normally be used anyway).MichaelBenjamin wrote:would it compile?
You find this word too strong, just as he found "gulag" too strong (imagine how someone who survived such punishment might feel about such casual use of the term). The word "toxic" has lost all meaning to me in this context, and I read little into it, as it now seems to be just internet shorthand for "distasteful in some sense; maybe strongly, maybe mildly, it's anyone guess" (what some linguists now call a "skunked term", just as "gulag" has become through over-use).i also would like some apology from tulamide for calling my writing "toxic", when it isn't.
I feel pretty insulted by this.
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.MichaelBenjamin wrote:ruby actually seems to be pretty similar to python in that regard
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.MichaelBenjamin wrote:how about array/list access? i guess ruby only has a generic list by default
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.MichaelBenjamin wrote:also regarding flowstone - when is a ruby codebox refreshed/recalculated/recompiled-and-evaluated?
All european languages are based completely or in great part on latin - the Romans just spreaded everywhere. Later on, Latin was the official language, used by those who could read and write (mostly clerics). That's why many Latin words are still part of a european language, for example the Latin "temperare" is used as "temper" in English and "temperieren" in German or "tempérer" in French.MichaelBenjamin wrote:also, bonus question:
why do you write e.g in englisch, which i guess means something latin like ex generis, and not write f.e. like for example? bcs in german we use the appropriate z.B., for zum Beispiel