The problem isn't so much that you are requiring a programmer to always 
program correctly, more that the correct program isn't always the 
obvious program and that an incorrect program isn't obviously incorrect.

The more I think about this, the more I think the correct implementation 
should be to require the user to explicitly Dispose of the bootstrap 
objects; in a single method you would do something like:

using (var myservice = IoC.Resolve<IThisService>()) {...}

no matter what (all objects that are able to be resolved must either be 
interfaces, unsealed classes or implement IDisposable themselves, and 
IoC.Resolve will always return something that implements IDisposable, 
either directly or via a generated proxy).

The generated proxies can be written in such a way that if the object is 
disposed of in the finalizer instead of being explicitly disposed, an 
exception could be thrown (at least I hope this could be possible while 
the program is running in debug mode).

Ayende Rahien wrote:
> I have a HUGE problem of require a programmer to always program correctly.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Development List" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to