Hi,

My confusion on keywords in Ruby is simple.  First, it was mentioned to
"... forget about #type.  It was there because we couldn't use "class" for
a method name back then."

My only guess why we couldn't use "class" back then is because "class" is
a keyword.  But a method consists of 2 parts: definition and calling.  I
guess even back then, for such an important method, it could have been
defined in C instead of in Ruby such as

    rb_define_method (rb_cObject, "class", rb_obj_class, 0);

Because in C, "class" is not a keyword, then using "class" in the method
definition as above (it is even a string there) is not a problem.

Now, the remaining problem must be in calling a method named "class" such
as

    anObject.class

However, it was also written that

 "$if" is not a keyword at all, just like "_if" or "aif" is not a keyword.

Therefore, I guess "anObject.class" is not a keyword either.  During
lexing and parsing, when seeing "$class", the Ruby parser must see the
leading "$" and says something like "the rest must be just a string
representing the name of the global variable (not a keyword)".

Therefore, when the Ruby parser sees "anObject.class" and sees the dot,
and after deciding that it is a form of method call of an object (and not
a floating point, for example), it must say something like "the string
before the dot must be the variable name, and the string after the dot
must be the method name (not a keyword)", and then the interpreter
dereferences the variable name to get the object, and then calling
something like

    rb_funcall (anObject_ref, rb_intern ("class"), 0);

That's why I don't understand why the method name "class" didn't work back
then.  Can anyone help here?

Regards,

Bill