[ANN] Ruby.shop

Kent R. Spillner wrote:

Awesome!
[SNIP]

Mea culpa! That was meant to be personal mail to Mr. Fulton.

Humblest apologies,
-Kent

···


Kent R. Spillner
“They that can give up essential liberty to obtain a little
temporary safety deserve neither liberty nor safety.”
- Benjamin Franklin

Hi,

/*
* Ruby’s Class Hierarchy Chart
*
* ±-----------------+
* | |
* Object---->(Object) |
* ^ ^ ^ ^ |
* | | | | |
* | | ±----+ ±--------+ |
* | | | | |
* | ±----------+ | |
* | | | | |
* ±-----+ | Module—>(Module) |
* | | ^ ^ |
* OtherClass–>(OtherClass) | | |
* | | |
* Class---->(Class) |
* ^ |
* | |
* ±---------------+
*
* + All metaclasses are instances of the class `Class’.
*/

Note that if I read this right Object doesn’t inherit Class but
extends it, as if we had
Object.extend Class
which of course doesn’t work since Class.class != Module.

I thus believe the loop at the top of the poster is just wrong.

The vertical relationships (e.g. one between Module and Object) are
class-superclass relations. Class’s superclass is Module; Module’s
superclass is Object.

The horizontal relationships are class-metaclass relations. Class has
its unnamed singleton class (metaclass), and its superclass is a
metaclass for Module, and so forth.

I hope this explains the figure. I believe it’s not wrong.

						matz.
···

In message “Re: [ANN] Ruby.shop” on 03/04/24, Mauricio Fernández batsman.geo@yahoo.com writes:

Ask, and you shall receive.

Hal

···

----- Original Message -----
From: “Kent R. Spillner” kent@zerosphere.org
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, April 24, 2003 12:38 AM
Subject: Re: [ANN] Ruby.shop

Think you could do a version of the “Ruby… for super programmers!”
shirt w/o the blue background and text? =) I know that w/o the blue it
loses it’s true Superman powers, but I personally find the big blue
block and the text to be jarring.

But the arrows in this ASCII chart are the
same as the ones in my drawing. True?

···

----- Original Message -----
From: “Hal E. Fulton” hal9000@hypermetrics.com


No! There are two totally different kinds of arrows in that chart!
That’s what so frequently confuses people. There are class' arrows andsuperclass’ arrows, and they really do mean totally different things, even
though both can be drawn with arrows. :slight_smile: (That chart is for showing how
the singleton classes fit into the picture, which I’m not sure is necessary
on your chart.)

Chris

Wish I could. :slight_smile: Will you share notes afterward? Or
a .mpg even?

···

----- Original Message -----
From: “Hal E. Fulton” hal9000@hypermetrics.com

You should attend my talk if you’re going to OSCON! :slight_smile:


I will.


I’ll have to think on this when I’m less hungry/tired/stupid.

It’s tricky. I didn’t get it myself until I drew a big picture with red
lines pointing a class’s superclass, and blue lines pointing to an object’s
class. Those are both pretty simple to understand. kind_of?' is trickier, though. It's one blue line, followed by 0-or-more red lines. It *feels* like you are simply going up a tree of some sort (and in a flatter language like Java, this analogy is just fine), but you aren't. You follow the blue line once, then you set off on the red lines in an orthogonal direction. The blue and red (the class and superclass) relationships are really different, but the fact that they both figure into the kind_of?’
relationship lulls us into thinking of them as being similar. They aren’t.

Chris

I’d like the following to appear somewhere:

/*
 * Ruby's Class Hierarchy Chart
 *
 *                           +------------------+
 *                           |                  |
 *             Object---->(Object)              |
 *              ^  ^        ^  ^                |
 *              |  |        |  |                |
 *              |  |  +-----+  +---------+      |
 *              |  |  |                  |      |
 *              |  +-----------+         |      |
 *              |     |        |         |      |
 *       +------+     |     Module--->(Module)  |
 *       |            |        ^         ^      |
 *  OtherClass-->(OtherClass)  |         |      |
 *                             |         |      |
 *                           Class---->(Class)  |
 *                             ^                |
 *                             |                |
 *                             +----------------+
 *
 *   + All metaclasses are instances of the class `Class'.
 */

Note that if I read this right Object doesn’t inherit Class but
extends it, as if we had
Object.extend Class
which of course doesn’t work since Class.class != Module.

I thus believe the loop at the top of the poster is just wrong.

Hmm, OK. It may be wrong according to the interpretation I
gave earlier. But the arrows in this ASCII chart are the
same as the ones in my drawing. True?

In the drawing:
Object ← Module ← Class <—
>____________________________| [my ASCII drawing skills suck :)]

In object.c
Object ← Module ← Class ← Object’

···

On Thu, Apr 24, 2003 at 07:16:57AM +0900, Hal E. Fulton wrote:
=======
Singleton class of Object
Object’ === (class << Object; self end)

So Object is a Class but it isn’t derived from Class.

Maybe I should just reverse the arrowheads? On the other
hand, the only other red arrow is IO → File. Maybe I
could reverse that one instead. :slight_smile:

Anyway, my drawing is buggy. All insights appreciated.

Wouldn’t it be cool if we automated the generation?
I found the following in the RAA:

GraphR - Graph-related Ruby classes


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

Less is more or less more
– Y_Plentyn on #LinuxGER

I am sure your figure is not wrong. Mauricio BTW was saying
that my drawing was wrong.

I think I introduced an error when I tried to
simplify it by omitting the singleton classes.

Thanks for your explanation.

Hal

···

----- Original Message -----
From: “Yukihiro Matsumoto” matz@ruby-lang.org
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, April 24, 2003 3:28 AM
Subject: Re: [ANN] Ruby.shop

The vertical relationships (e.g. one between Module and Object) are
class-superclass relations. Class’s superclass is Module; Module’s
superclass is Object.

The horizontal relationships are class-metaclass relations. Class has
its unnamed singleton class (metaclass), and its superclass is a
metaclass for Module, and so forth.

I hope this explains the figure. I believe it’s not wrong.

In the drawing:
Object ← Module ← Class <—
>____________________________| [my ASCII drawing skills suck
:)]

This agrees with my drawing… but it conflates
Object and (Object). Originally that was to
avoid mentioning the singleton classes, but I
think I introduced some inaccuracy thereby.

Chris: Concur?

Wouldn’t it be cool if we automated the generation?
I found the following in the RAA:

GraphR - Graph-related Ruby classes

:slight_smile: Excellent idea… but it would still require
some hand-massaging, I think.

Hal

···

----- Original Message -----
From: “Mauricio Fernández” batsman.geo@yahoo.com
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Thursday, April 24, 2003 2:20 AM
Subject: Re: [ANN] Ruby.shop