A
Adam Gardner
This loops inifitely, but it doesn't seem like it should.
--
require 'singleton'
class SingleThing
include Singleton
def initialize
@a = OtherThing.new
end
end
class OtherThing
def initialize
@single_ref = SingleThing.instance
end
end
a = SingleThing.instance
---
It looks as if the the SingleThing.instance method doesn't start
returning the allocated instance until initialize has *finished*, but it
seems to me it should start returning the allocated instance as soon as
initialize *starts*. Otherwise, methods called during initialize (and
the methods they call, and so on) can't refer back to the singleton
object using SingleThing.instance.
Any thoughts?
--
require 'singleton'
class SingleThing
include Singleton
def initialize
@a = OtherThing.new
end
end
class OtherThing
def initialize
@single_ref = SingleThing.instance
end
end
a = SingleThing.instance
---
It looks as if the the SingleThing.instance method doesn't start
returning the allocated instance until initialize has *finished*, but it
seems to me it should start returning the allocated instance as soon as
initialize *starts*. Otherwise, methods called during initialize (and
the methods they call, and so on) can't refer back to the singleton
object using SingleThing.instance.
Any thoughts?