furufuru / ccsr.u-tokyo.ac.jp (Ryo Furue) writes:

> Hi there,
> 
> How do you report the failure of object creation, that is, if you find
> it impossible to properly initialize the object in the "initialize"
> method?  Raising an exception is clearly an option.  But, what if the
> "failure" is a normal part of the flow of the program?

At least one framework I've used (BeOS) set a status variable. It was the
programmers responsibility to check it after calling new. For example,

    class Foo
	attr_reader :initializedProperly
	def initialize
	    @initializedProperly = true
	    # ...
	    if someError
		@initializedProperly = false
	    end
	end
    end


    foo = Foo.new()
    if !foo.initializedProperly
	# ...
    end

Jim
-- 
Jim Menard, jimm / io.com, http://www.io.com/~jimm/
"Lead me not into temptation. I can find it myself."
    -- Jeffrey Kaplan in rec.humor.oracle.d