[Pythonmac-SIG] What to do about missing toolbox routines

John W Baxter jwblist@olympus.net
Sun, 12 Dec 1999 18:58:29 -0800


At 22:32 +0100 12/12/99, Jack Jansen wrote:
>I can think of two decent solutions, and I'd like feedback on the
>preferred one (but note that the actual implementation will also depend on
>the amount of time I have, so even though everyone agrees on an
>optimal one that doesn't imply it'll actualy be implemented:-):
>
>1. Upon first call of a toolbox method check whether it actually
>   exists and raise an exception if it doesn't.
>2. Upon import of a plugin module test all toolbox routines for
>   existence (by comparing the routine address to 0) and for those that
>   don't exist don't export the Python method either. This is a lot
>   more work.

Alternative 3:  export boolean hasToolboxFoo for every Foo which is weak
linked (or every such call for which there isn't a Gestalt call which will
detect presence/absence).  That's a rather verbose name...since we're
looking at modules it could be perhaps reduced to hasFoo without name
collision problems.

1. is probably cleanest (and avoids assumptions like "if it has X it must
have Y and Z," which while true up through some System might become untrue,
and avoids lazy programmers <me!>).

   --John
-- 
John Baxter   jwblist@olympus.net      Port Ludlow, WA, USA