5 ms·
Could you elaborate on how you see Ruby as a modern Smalltalk?
by endlessvoid94 14y ago
Could you elaborate on how you see Ruby as a modern Smalltalk?
- cbsmith 14y agoSeriously? Ruby block syntax is straight up lifted from Smalltalk, not to mention much of the semantics and standard library. Ruby seems like what Smalltalk would be if it was built as a scripting language with file-based structure... and then dragged through the mud of Perl syntax. ;-)
- endlessvoid94 14y agoNo need to be condescending, I was genuinely curious. At first glance, the two languages seem similar, but not as much as Clojure is to CL (or any other lisp).
- rubinelli 14y agoIt's hard to detect if a terse question is a request for information or a challenge. Back to the subject, Ruby's OO is much closer to Smalltalk's vision. Method dispatching in Java is essentially dereferencing a function pointer (found by traversing a class hierarchy) and adding a hidden argument (self.) In Ruby, you can override an object's method dispatching mechanism to be whatever you want it to be (although the default behavior is very similar to Java's.) This makes it a lot harder to optimize, (your JIT compiler can't simply inline those calls) but it opens all kinds of interesting meta-programming possibilities.
- spooneybarger 14y agoFor anyone interested in the general topic of implementing a dynamic language on the jvm, Charles Nutter has a ton of good material around invoke dynamic and jruby.
- aidenn0 14y agoAs a CL developer with only a bit of dabbling in Smalltalk and Ruby, Smalltalk and Ruby seem much more similar than CL and Clojure. In particular, Clojure's preference for vectors over lists in many situations, combined with its much stronger preference for immutable objects makes it highly distinct from CL. The requirement for explicit trampolines to allow efficient tail-calls makes it distinct from any (non-toy) lisp I've ever used.
- cbsmith 14y agoSorry, I wasn't intending to be condescending. I thought you were making a joke.
- candl 14y agoRuby block syntax may have been inspired by Smalltalk, but this is where the similarities end. Ruby block implementation is simply awful (an afterthought?), and no way near as powerful (and simple) as the equivalent in Smalltalk.
- masklinn 14y ago> Ruby block syntax is straight up lifted from Smalltalk Uh... no it's not, it's lifted from C/Perl with a smattering of Pascal. > not to mention much of the semantics and standard library. The semantics are as much Perl as they are Smalltalk, if not more so. And many pieces of Smalltalk are missing (first-class blocks to start with, Ruby's blocks are a hack)
- jasim 14y agoRuby steals the concept of 'everything is an object' from Smalltalk. Compare http://edwinmeyer.com/Release_Integrated_RHG_09_10_2008/chapter02.html http://edwinmeyer.com/Release_Integrated_RHG_09_10_2008/chap... with http://en.wikipedia.org/wiki/Smalltalk#Object-oriented_programming http://en.wikipedia.org/wiki/Smalltalk#Object-oriented_progr....