Hi,

In message "[ruby-talk:17721] Null Pattern"
    on 01/07/12, Keith Hodges <K.Hodges / ftel.co.uk> writes:

|Q.1 What is the best way to define a new global constant like "nil" (i.e. lowercase).

There's only one way: hack the parser.  Pseudo variables: nil, false,
true, self, __FILE__, and __LINE__ are built in Ruby syntax.

|Q.2 I would like to be able to obtain information about the instanciator of aNull
|so far I have found Kernal#binding and Kernal#caller but I cant find out how to use
|these to get
|the information that I want, which is "Object, and method that instanciated me."

Currently, no.  new caller interface is in RCR.

|Q.3 given the code below is there a way to exit a call chain as follows
|
|a=null
|a.nice.way.to.avoid.testing.for.nil.all.of.the.time
|#I want to get <HERE> as fast as possible!
|
|at present my implementation of Null#method_missing returns self. This means that the
|code above calls Null#method_missing on each "undefined message eating null" method
|call, 11 times!
|
|what I was wondering is whether there is a way to jump from a.nice (implemented by
|Null#method_missing) to <HERE> in a quick and elegant manner (i.e. like a throw catch
|but without the semantics)

Without using catch nor rescue?  No (Sorry for negative answers).

But this is intersting.  If someone would come up with nice solution
proposal, I'd like to consider implementing it (maybe).

							matz.