From: Stu Date: 2013-02-21T08:47:35+09:00 Subject: Re: THE CLASS/OBJECT CHICKEN-AND-EGG PARADOX Here's a simple conceptual model to think of if it seems a bit obfuscated. Go to your deskop and create a folder called myfolder. open myfolder and create a folder inside it called myfolder. Considering your desktop is TOP level much like main() is to many programming languages and environments. Or how Class is an abstraction for object oriented languages what Stucts are abstracted data types to procedural languages. If you want to blow your mind a bit you can create an alias, shortcut, or softlink depending on operating system to reference (or point to) the original myfolder. Actually I'm not sure if that's helpful. I'm better with fixing problems that exist at a gestalt level. Maybe looking at ObjectSpace may also give some hints (or a screen full of junk) on the interpreters preprocessing state. On Wed, Feb 20, 2013 at 5:27 PM, Eric Christopherson wrote: > On Wed, Feb 20, 2013 at 5:15 PM, Stu wrote: >> Rubinius is a smalltalk based vm >> written in c++( iirc) at the bootstrap level and written in pure ruby >> beyond that. > > Minor nitpick: I think you're confusing MagLev, which has a Smalltalk > VM base, and Rubinius, which has an LLVM base. My bad. I can't install MagLev on FreeBSD. Is it worth checking out. For extension languages I prefer these interpreters to be able to run everywhere. I don't know how I was mislead. wikipedia mentions a short stub on using the smalltalk bluebook but outside of using pry to become inspired on some of the methods already in place in the language I generally use mri and in some cases jruby. What's the use case for maglev? Fuse ruby with squeak? ~Stu On Wed, Feb 20, 2013 at 5:15 PM, Stu wrote: > Xavier - > > Meta-Programming Ruby is a decent book which explains a bit better on > your question. Though Blacks book is a better book for just starting > ruby it mainly is just a beginners book. > > It may be helpful to understand what a Module is in ruby and how it's > used with classes in ruby's object model. Also you'll want to > investigate what a Eigenclass class is and what singleton methods are. > Also note how ruby's reflection and method lookup syntax may always > be telling the whole truth. Mainly this has to do with scoping rules > and hidden classes as well to allow embedded languages within ruby > which can be seen in ruby's recursive style iteration syntax > methodology. > > One way to visualize it outside of the repl would be to consider that > lookup begins at the instance object's receiver and moves to the right > and then up. > > Showing the C code would be to see what the actual implementation is > doing. If you were to view it as a flattened set of instructions a > reference pointer would simply be a hash which simply is a two > dimensional array. > > If your interested in reading ruby implemented in ruby instead of c > check out Rubinius and install pry. Rubinius is a smalltalk based vm > written in c++( iirc) at the bootstrap level and written in pure ruby > beyond that. > > Of course if object based programming is new to you it's also > necessary to grok what self is and how message sending and > communication works. Consider it just the one of the many programming > models which ruby has at the end users disposal. > > ~Stu > > > On Wed, Feb 20, 2013 at 4:03 PM, Xavier R. wrote: >> Matt Mongeau wrote in post #1098076: >>> It's not really a paradox. Take for example >>> irb(main):001:0> a = [] >>> => [] >>> irb(main):002:0> a << a >>> => [[...]] >>> >> >> Is it possible to give some small ruby code in-contrast with C - code >> for better understanding. >> >> That might clear the picture more clearly. >> >> >> Thanks >> >> -- >> Posted via http://www.ruby-forum.com/. >>