On Mon, 2004-04-12 at 16:35, Carsten Ziegeler wrote: > Niclas Hedhman wrote: > > > > On Saturday 10 April 2004 00:24, Stephen McConnell wrote: > > > > > Secondly - concerning dynamic lookup I think we should be following > > > something closer to the approach suggested by Bruno Dumon - ie.: > > > > > > /** > > > * @avalon.dependency type="Locator" key="locator" > > > */ > > > public void service( ServiceManager manager ) > > > { > > > // get the ref widget > > > Locator locator = (Locator) manager.lookup( "locator" ); > > > Widget redWidget = locator.locate( Widget.class, m_map ); > > > } > > > The approach above is imho not better than the current Selector approach; > it's slightly different so. > I think you and Stephen are mixing the use of the lookup mechanism > in Merlin and the interface/functionality provided by the framework. > The framework api does not/should not know anything about meta info etc. > > But it seems noone else apart from me is interested in enhancing > the framework api, so we can skip this for now.
I'm actually interested in enhancing this mate. A while back I asked about the use of Class in lookup rather than a String Role: http://marc.theaimsgroup.com/?l=avalon-dev&m=105914629325097&w=2 and there were various responses (rightly) pointing out the decisions behind it. I still tend to favour specifying the component you want by an interface Class instance, but I follow the reasoning behind using a String. With service selector, I sent in an RT a while back about parameterized lookups which from what I can tell is similar (at a usage level) to the 'locator' above: http://marc.theaimsgroup.com/?l=avalon-dev&m=105914503723538&w=2 After getting some really informative responses I agree that parameterized lookup's aren't a good idea (eg. no type safety passing arbitrary maps to the container, etc). It would be great to fix up the service selector dilemma though, as it's been container specific for ages and ideally should be specified by the framework api. I remember when we had the old Avalon 5 emails we looked at having: Object lookup(String role, Object hint); // I agree hint isn't the best name Anyone remember the results of that discussion? Cheers, Marcus --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]