Here is something concrete to add to the discution :)
I was sure it would be easy but did not expect it to be that easy, this patch allows to do this:
# use celluloid as before, nothing changed
# do what you want WITHOUT celluloid
# use celluloid as before
And as a bonus you can even call "Celluloid.start()" as many times as you want, the system will only be started once.
So what do you think of this ?
As for the documentation the more I think of it the more I think it should not be documented, if you need this for a good reason you will know where to look.
PS: Github do not shows correctly the file rename, the real diff is really small.
I can't exactly say I'm happy with having to massively reorganize the codebase just to facilitate a request I'm uneasy about to begin with. I think there's a lower impact way to do this, like moving all the stuff you don't want to happen at startup into boot.rb and setting some constant that's checked prior to requiring boot.rb
I don't think there is any reason to move all of the code out of celluloid.rb.
From reading the email thread, it sounds like you just wanted to stop the starting of the default actors.
@halorgium yes but since requiring celluloid like currently should start those actors how would you do it ?
@tarcieri I understand your feeling but the diff is really not what it looks like in github, it just don't understand that a file has been renamed, what I did was:
I will give the constant idea a try tomorrow if you prefer.
The const idea is similar to the one added to Rake a while back.
allow requiring celluloid without autostart
here is another lighter attempt :)
The new method on the Celluloid module means that all actors will now have this method by default.
Can you switch it to a module method explicitly?
I think a better way to do this is to put everything that starts on boot into boot.rb, then selectively require that based on CELLULOID_DISABLE_AUTOSTART
Yer, this makes sense.
Then you can simply require 'celluloid/boot' to get the original behaviour.
and it would lead to this when you need to start celluloid later:
very ugly :s
Why is that "very ugly" and how would it be any less ugly from what you're proposing?
Maybe that is just me but adding a require in a function makes me sad.
Not sure of the implementation of this feature but I'd like to be able to use Celluloid::Future without booting up the actor singleton. In fact, I don't really like libraries that force this kind of singleton via a require statement usually anyway.
You will not be able to use futures without a running celluloid system, what would you want to do with it ?
let's forget this, it does not look like we will get anything from it.