[Pythonmac-SIG] Naming schema for wrapped Apple frameworks
Bob Ippolito
bob at redivi.com
Tue Dec 9 10:23:29 EST 2003
This was moved from a discussion on the MacPython AIM chat room with
Donovan, Jack, and me because Jack had to go and thought this issue
should be brought up on the SIG anyhow. Please comment or add
suggestions to help Jack come to a decision about how to proceed with
this for future versions of MacPython.
The problem discussed was that Carbon.ShortName (implementation) and
Carbon.LongName (constants) way of wrapping things is annoying.
Reasons:
* The implementation isn't very useful without the constants,
requiring two imports everywhere
* You must know both the long name (which is ok, because that's
generally the name of the framework or header file) AND the short name
(not ok, these are made up semi-arbitrarily).
* Throwing everything in the Carbon namespace sucks, not all of it is
Carbon anyways
* C programmers "#include <Carbon/Carbon.h>" and then the kitchen sink
is available. Python programmers have to know which framework they are
talking to (not necessarily a problem).
Proposed new schemes:
* Make it flat like C (highly unlikely)
* Decide to drop or not drop the Carbon prefix for everything (I say
drop it, not everything in MacPython's Carbon is necessarily in the
real Carbon anyhow)
* Make each constants+implementation part of a separate package, f.ex.
LaunchServices.LaunchServices (constants) LaunchServices.Launch
(implementation)
* Make each constants+implementation part of a separate package that
imports * from constants and implementation in __init__.py, so it looks
like a single module
* Make each constants+implementation part of a separate package that
has some consistent naming for constants and implementation modules,
f.ex. LaunchServices.constants and LaunchServices.implementation
(possibly with LaunchServices.LaunchServices as the "import *")
* Make lots of namespaces, to mirror the apple setup. For example,
ApplicationServices.LaunchServices
Why constants and implementation have been separate for so long:
Jack Jansen: Back when I had on LC2 1400 constants was a lot of memory.
.....
Jack Jansen: And even today 15000 names (approx) is still a lot of
memory.
(this is probably referring to a flat "#import <Carbon/Carbon.h>"
namespace)
-bob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2357 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20031209/dbdc16a5/smime.bin
More information about the Pythonmac-SIG
mailing list