@p Okay, got that straightened out. Object::methods is different than methods. methods holds what is in the current context, and I can find set show and update there, but not add. (mystery solved xD)
@p ahh, you can see I referenced the wrong object, that should have been Object::methods. So I jumped the gun on that message xD I'll get back to you on that...
_why is really fun. Left when he got doxed. Like, DFE-and-nuke left. He explained some in the book he released "posthumously".
> I noticed some of the things, that require leg work to do in JavaScript, are the default in Ruby.
This is one of the things I like a lot about it: I don't want to rewrite some things that are primitive operations in Lisp or Perl or even awk, C, whatever. That also makes it very convenient for interactive use, like I'm looking at a new dataset or a new Postgres DB or something like that, I don't have to bash out a lot of basic stuff to do basic analysis or data exploration.
> Why does python even exist? (though after talking with a friend, the answer seems to be, people prefer a simpler smaller syntax)
Neither was very popular at the time they were created, so they probably weren't aware of each other, ha. Ruby is slightly older but I think it's by months. The languages appeal to different sensibilities, though, and that has made different communities spring up around them, which means different libraries and whatnot, and so some stuff is lower-friction in one language versus the other. Python's not likely
> My primary interest in coding these days, is either a micro controller, or to make something with graphical user interaction.
Ah, you might be interested in mruby, designed to be an embeddable subset of the language. Lua-but-it's-Ruby; I believe it runs on some microcontrollers.
To be honest, if I am doing a GUI with Ruby, I usually just open up a pipe to wish (though I have played with the SDL library a lot). I don't think I have attempted to use ruby2d before.
> So, I am guessing there will be some kind of "make Window current context" command to be covered.
I had a look at https://www.ruby2d.com/learn/get-started/ and it's actually pretty cool, looks like fun. Their sample code runs for me. I don't know where you got your sample code from, but it looks like they create the basic window and then merge that with the top-level object, and it looks like `Window` gives you (per https://www.ruby2d.com/learn/window/ ) a reference to the Window singleton.
You can actually tell it's added things to the toplevel by doing this in irb:
Oh! Well that is obvious after you say it lol. And, I had to reference Window (which I believe is initialized as a singleton) to "add" an object, because the add method wasn't added to the top-level object.
You know, I kept thinking, "Ruby is just inferring what my code means, and piping my request to the correct object." But, that seems pretty irrational in hindsight xD
I'll take some time to digest the rest of your message :D
@p I've been enjoying the book. And, I really like some of the design decisions. I noticed some of the things, that require leg work to do in JavaScript, are the default in Ruby. Why does python even exist? (though after talking with a friend, the answer seems to be, people prefer a simpler smaller syntax)
My primary interest in coding these days, is either a micro controller, or to make something with graphical user interaction. So, of course I am doing the silly thing of reading Why's and playing with Ruby2D.
Running their getting started examples feels like, PFM xD RubyMine IDE doesn't seem to know what is going on either. But, the answer seems right under my nose.
Through experimentation, update, set, and show, all seem to be instance methods for Window. So, I am guessing there will be some kind of "make Window current context" command to be covered.
The third version, feels the most like something in another language, make a new instance of Window.
Anyway, just wanted to let you know that I am enjoying Ruby, it is pretty neet.
> And, remembered that I've never really looked at ruby. (but I've often heard it talked about)
Oh, wow. It's basically what I have been using for work since forever, so it feels boring to me sometimes, like not really worth mentioning. But it's really great for mangling arrays and strings, lot of easy support for talking to random databases (SQL or Redis or whichever), very nice REPL, so that makes it useful for interactively poking at data. There's some disdain for it, but it's like Lisp, Smalltalk, and Perl had a baby. Like, the fact that you can pass a block to gsub is already enough to put it on top of most string-manglers:
irb(main):001:0> i=0; "This is a test of the string substitutions.".gsub(/i/) { |m| "[number #{i+=1}]" } => "Th[number 1]s [number 2]s a test of the str[number 3]ng subst[number 4]tut[number 5]ons."
It's what I usually reach for if it looks like awk won't cut it.
> Any thing else you can point me at to see the shine of ruby?
I still like "_why's (Poignant) Guide to Ruby", but when he pushed that out, I already knew Ruby. The way I learned was I half-read and half-skimmed the Pickaxe book (which is now notorious for being a terrible way to learn the language) and basically having done some Perl and some Common Lisp, I was able to more or less guess how things like map worked, and I hung out on the mailing list. Back in The Day, if someone managed to use Ruby at work, they'd send email to the list, and people were on there puzzling things out or making up challenges or doing code golf.
[1,2,3].map{|i|i**2}.inject(&:+)
I think the best way to learn Ruby is the REPL. Like fire up irb and go for it. Matz's goal was to make a language that was fun to use, and it's pretty successful at that.