An old Delphi hacker from way back. That is the general way that it works, as I can also atest.
Scott > -----Original Message----- > From: Paulo Gaspar [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 11, 2002 5:14 PM > To: Avalon Developers List > Subject: RE: Divergence from Avalon (was Re: [RT] Is Poolable > Harmful?) > > > Hi again, > > > -----Original Message----- > > From: Peter Donald [mailto:[EMAIL PROTECTED]] > > Sent: Friday, January 11, 2002 11:20 PM > > > > > > On Sat, 12 Jan 2002 07:48, Paulo Gaspar wrote: > > > Why does putting a String and a Context instead of an Object > > > transmit more knowledge. > > > > Because the string is meant to indicate a Role which in > turn specifies > > an > > interface. > > Yes, that bit is all over Avalon. > > But the String does not make it SAFER. You have to put the > right thing there. It is not safer than using an Object. It > is not like using an enumerated type. > > It is funny how Delphi has something that would make the role and the > lookup for a rule type safe. Lets see if I still remember... > I think a lot of syntax is going to be wrong but is something > like this: > > type // type declaration section > > TRole = interface(...) > ... > end; > > RoleType = type of TRole; // The interesting construct > > TMyRole = interface(TRole) // extends TRole > ... > end; > > And now you could declare lookup() like this: > > function Object lookup(role: RoleType); > > And it will only accept as parameter types that extend Role, like in > > c := cm.lookup(MyRole); > > > I miss this one. Sorry if there are syntax errors everywhere but I > think you will understand the meaning. > > Actually, I am not 100% sure this works with interfaces but I > sure used it with classes. > > > > > > It is all in what you do with it. > > > > > > I could call lookup like this: > > > c = cm.lookup("$#@))(sdjhfkjh"); > > > > This would violate Avalons design as "$#@))(sdjhfkjh" is > not a valid > > role > > name. All CMs would through a ComponentException (or should). > > > > The string passed in tends to look like > > > > com.biz.MyInterface > > > > or optionally > > > > com.biz.MyInterface/SOmeOtherMagicValueAtEndAfterSlash > > Sure, I was talking about type safety. > > You can pass just the same value if lookup has a Object > parameter instead of a String parameter. And type safety goes > not very far in this case because you always have to defend > yourself with constants and so to be sure you pass a valid value. > > > > > I like very much this structure. > > > > Its almost there already - except we use different names for it. > > Context == > > what you call CM and CM is what you called ServiceManager. > > > > The only missing thing is Context passed into > ServiceManager where now > > we > > require it to be serialized to a string and tacked ont to end of > > Role string > > Why? > > A Context does not allow me to get a SingleThreaded component > and then release it. Even from an interface POV something is missing. > > Why do you insist my CM is a Context? > > > > -- > > Cheers, > > > > Pete > > > > ---------------------------------------- > > "Liberty means responsibility. That is > > why most men dread it." - Locke > > ---------------------------------------- > > Oh! A classical one. > > > Have fun, > Paulo Gaspar > > > -- > To unsubscribe, e-mail: > <mailto:avalon-dev-> [EMAIL PROTECTED]> > For > additional commands, > e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>