A bit late, but I didn't have time to reply this weekend. I think a feature 
like this is realy nice, but only if it works in all cases, all the time. You 
must be able to rely on Wicket to detach your IDetachable no mather where it 
is in your component hierarchy, also when it's not directly referenceble from 
a component. This means you will have to use reflection to visit all fields 
and all fields of fields, etc, which would probably give quite some overhead.

The reason why I'm against adding something that can only detach models in 
components is that I think people well get confused when to detach and when 
not to detach. For example, a single model will get detached, but a list of 
models will not. Detaching models already is a major problem for many people, 
adding helper magic will only make it worse.

Adding this as a feature does not make any sense, because it destroy the 
possibility of using it in any component that might be reused later on in a 
different application.

In short: -1 for adding something that can only detach detachables directly 
referenced from a component.

Best regards,
Emond

On Friday 06 April 2012 09:42:42 Igor Vaynberg wrote:
> i wrote a IDetachListener that automatically detaches any IModel
> fields found on components. is this something we would be interested
> in for core? its been running in production for a while without any
> noticeable overhead and its nice not to have to implemenet onDetach()
> all the time just to forward it to secondary models. the only downside
> is that once we introduce this feature we can never remote it because
> doing so will break code.
> 
> thoughts?
> 
> -igor

Reply via email to