[PEAK] removing adaptions

Phillip J. Eby pje at telecommunity.com
Mon Oct 25 17:17:45 EDT 2004


At 10:08 PM 10/25/04 +0200, Gabriel Jägenstedt wrote:
>Hi!
>
>I've got a system that is meant to be adaptable to different languages.
>I've tried several different approaches and have finaly found one that I
>think fits the purpose.
>
>I only use protocols.
>
>Each language that is supported has to create two things. An Interface
>and a language module.
>
>The language module provides ILang to show that it's a language and
>IEnglish to show that it's the english language.
>
>Inside the module there resides different adapters EnglishParserAdapter
>EnglishCommandAdapter and so on.
>I have gotten everything to work perfectly with a bit of directory
>scanning, importing and adapting so that I can call lingo('english',
>IParser) and this returns a parser that understands english.
>
>Now comes the problem if one desides to support different languages
>during sessions there is already another adapter in play.
>Is there a good way to disable an adapter? Or is my design faulty as per
>usual =)

I don't know, because there's not enough here for me to even begin to 
understand what you're doing, how, or why.  :)

But I will attempt to dissect a couple of clues anyway.  First, it's not 
clear to me that you are "adapting" anything here.  You've never once 
mentioned what you're adapting *from*.

It sounds more to me like you are registering *implementations* of various 
things that you need, and then using them.  If that's so, then it's largely 
unrelated to adaptation; it's more like using PEAK's configuration 
facilities to register the availability of various services.  (And PEAK 
offers lots of very convenient ways to do things that sound a lot like the 
things you mention here.)

However, if you *are* using adaptation to adapt *from* something, then you 
should keep that original something around if you need to adapt it to 
something else, as is strongly suggested by the PyProtocols manual.




More information about the PEAK mailing list