On Mon, 21 May 2001, Dave Thomas wrote:
> Mathieu Bouchard <matju / sympatico.ca> writes:
> > This is a proposal to append this notification to the behaviour:
> > 	if bar.respond_to? :const_name_is
> > 		bar.const_name_is(:Foo,current_module)
> > 	end
> Matju:
> Could you provide a couple of examples of where this would be useful?

First of all, pop up irb and try this:

x = Class.new   #==>   #<Class 0lx4020d7f4>
Foo=x           #==>   Foo
x               #==>   Foo

Obviously, Ruby does it "behind the scenes". Therefore it is useful.
Therefore it is worth making available to everybody. This should be a
sufficient rationale by itself.

If you are looking for more concrete examples, well, there is RubyX11.

In RubyX11 I have this notion that a type is basically representable as a
set membership function (this is a more general notion of type than what
people usually think of). So I have extracted Module#=== and turned it
into a separate interface called X11::Type (which I have extended with X11
marshalling specificities). Many type-representing objects are not classes
(nor modules), and so they don't fit with Ruby's assumption that all
constants worthy of knowing their own name are modules.

matju