[Pythonmac-SIG] package structure for OSA interfaces

Michael J. Barber mjb@uma.pt
Tue, 22 Jan 2002 13:15:10 +0000


On Tuesday, January 22, 2002, at 11:38  AM, Jack Jansen wrote:

>
> On Tuesday, January 22, 2002, at 12:22 , Michael J. Barber wrote:
>> There is a surprisingly simple solution, but unfortunately only for 
>> Python 2.2+. Define the required events in StdSuites.Required_Suite, 
>> remove the required events from StdSuites.Standard_Suite, and make 
>> StdSuites.Standard_Suite a subclass of StdSuites.Required_Suite. 
>> Everything else stays as it is. With the new "diamond rule" for 
>> multiple inheritance, that takes care of everything.
>>
> This sounds like a great idea!
>
Good, thanks.

> I think we can do one better, even: define these events in a magic, 
> handwritten suite (StdSuites._builtin_Suite comes to mind) and use this 
> as the base class for both StdSuites.Standard_Suite and 
> StdSuites.Required_Suite. These latter two are then still generated, 
> and there's a one-line bit of magic in gensuitemodules that recognizes 
> we're reading an AETE (not AEUT) for standard or required and inserts 
> the magic baseclass.
>
> Would this do the trick?

Hmm, depends on some implementation details that I'm not so sure of. Let 
me make sure I understand the distinction between AEUT and AETE. 
Checking a bit with ResEdit seems to indicate that AETE goes with 
applications and AEUT is in the AppleScript extension (and possibly 
elsewhere?). If that's the case, shouldn't the magic baseclass get 
inserted for AEUT, and for AETE gensuitemodule just grabs 
StdSuites.Standard_Suite and StdSuites.Required_Suite, so that the only 
difference is in how the StdSuites package is generated?

Basically, I think the 'one-line bit of magic' depends on implementation 
details that I don't understand very well. Or maybe I'm just missing the 
logic you have in mind.

The package structure sounds beautiful, though. The magic baseclass 
should be easy to write; in fact, I think the hacked version I suggested 
in the original message would work just fine.

There is another piece of checking that could be done. If there is 
neither an AEUT nor an AETE resource, then we know that we'll want an 
interface that only offers the required events. Whether that should be 
based on StdSuites._builtin_Suite or StdSuites.Required_Suite is 
probably a matter of taste. I would go with Required_Suite for 
consistency with other packages.

>> The question remains: is there a fix for Python 2.1 and earlier? I 
>> don't see one.
>
> It doesn't really interest me all that much. I don't think there are 
> good reasons not to switch from 2.1 to 2.2, which is if anything more 
> compatible with older machines.
>
And since it looks to be a quite obscure problem, I can't say as I'm 
terribly interested either.