Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Infinite loop with Singleton mixin
Adam Gardner
2/25/2009 4:46:00 AM
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?
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Infinite loop with Singleton mixin
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password