On Wed, Mar 13, 2013 at 11:20 PM, Kedar Mhaswade <[email protected]> wrote:
> Dear Rubyists,
>
> I recently wrote a document about Ruby's classes, objects and methods.
> The goal was to find out whether I understand them right and whether I
> can explain it simply enough in writing.
>
> It is available on the Google Drive:
> http://bit.ly/ruby-classes-and-objects
>
> With the help of some text, a few pictures and some examples, it tries
> to explain these basic concepts in Ruby. I have taken help from Dave
> Thomas's book and Matz/Flanagan book but the document is my own
> interpretation. It has become rather long, but I have worked hard on
> being correct and precise.
>
> I will be honored if you read and review (and help correct errors in)
> the document.

“abc” is an instance of String
This is not true. Said expression is a constructor of a String which
will return a different String instance on every evaluation.

"Depending upon the data type of the object, a variable is a name for
the object itself or a reference to it."
In an introductory text I would not _start_ with this statement.
Better: "A variable is a place that stores a reference to an object."

Same for your treatment of "immediate values". This is really an
implementation detail which should be taught much later.  I think it
helps understanding if one does _not_ bring this up that early.
Actually, from a point of view of the user of the language it does not
matter _at all_ (only for performance, but not functionality wise).

"If the method were not found in String, Ruby would have followed the
superclass (sc, green arrow) links in search for the method
definition." and "It creates a new anonymous class object and inserts
it into Foo’s superclass chain!"
This is not true.  The chain of classes and modules found via
Module#ancestors is traversed instead.  There is no need for a new
anonymous class.  The only place where new classes are automatically
allocated is the singleton class of an instance.

I stopped reading there as I found your diagram about singleton quite
complicated and unclear.

Cheers

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

-- 
[email protected] | 
https://groups.google.com/d/forum/ruby-talk-google?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"ruby-talk-google" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to