"Ben Sizer" <[EMAIL PROTECTED]> wrote:
> On Feb 10, 8:42 am, Steve Holden <[EMAIL PROTECTED]> wrote: > > Hendrik van Rooyen wrote: > > > <[EMAIL PROTECTED]> wrote: > > > "Ben Sizer" <[EMAIL PROTECTED]> wrote: > > > > >> Ben> Python extensions written in C require recompilation for each new > > >> Ben> version of Python, due to Python limitations. > > > > >> Can you propose a means to eliminate this limitation? > > > > > Yes. - Instead of calling something, send it a message... > > > > I suppose you are proposing to use the ISO 19999.333 generic > > message-passing interface for this? The one that doesn't actually call a > > function to pass a message? > > I'm assuming you're being facetious here..? Please see my reply to Steve - and Yes, I believe he was oulling the oiss... > > Of course, functions get called at the ends of the message passing > process, but those functions can stay the same across versions while > the messages themselves change. The important part is reducing the > binary interface between the two sides to a level where it's trivial > to guarantee that part of the equation is safe. > > eg. > Instead of having PySomeType_FromLong(long value) exposed to the API, > you could have a PyAnyObject_FromLong(long value, char* > object_type_name). That function can return NULL and set up an > exception if it doesn't understand the object you asked for, so Python > versions earlier than the one that implement the type you want will > just raise an exception gracefully rather than not linking. > > The other issue comes with interfaces that are fragile by definition - > eg. instead of returning a FILE* from Python to the extension, return > the file descriptor and create the FILE* on the extension side with > fdopen. This sort of thing is exactly what is wrong with the whole concept of an API... Its very difficult, if not impossible, to guarantee that *my stuff* and *your stuff* will work together over time. Whereas if *my stuff* just publishes a message format, *anything* that can make up the message can interact with it - but it requires *my stuff* to be independently executable, and it needs a message passing mechanism that will stand the test of time. And it can create a whole new market of "Mini Appliances" each of which has *your stuff* inside them... - Hendrik -- http://mail.python.org/mailman/listinfo/python-list