Weird Language Features
Steven D. Majewski
sdm7g at Virginia.EDU
Mon Feb 19 13:30:52 EST 2001
More information about the Python-list mailing list
Mon Feb 19 13:30:52 EST 2001
- Previous message (by thread): Weird Language Features
- Next message (by thread): [Q] how to protect python program from decompilation -- a better idea
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In objective-c, the functional/procedural part of the language is just ANSI C, so, with respect to undefined functions, the answer would be the same as C: no. The object-oriented feature of objective-C are based on smalltalk, so with respect to methods, it's like smalltalk. Any class can implement forwardInvocation: (as well as some other introspective methods) to pass methods it doesn't understand to a proxy or delegate. (I believe you can even redefine this method for NSObject itself, so that all subclasses will inherit this new implementation. ) The python<->objective-c bridge in PyObjC uses this in it's implementation. There are proxy objects sitting between python classes and their objective-c equivalents. Some common transformations are built in, so NSStrings and NSArrays can be treated as python sequences, but in general, python methods are name-mangled into objective-c method names by translating colons to/from underscores, and the proxies forward them (depending on which direction you're going -- objective-C calling Python or Python calling objective-c.) -- Steve Majewski <sdm7g at Virginia.EDU> On Sun, 18 Feb 2001, Eric Clayberg wrote: > "Dave Cross" <dave at dave.org.uk> wrote in message > news:nnhv8t4obq30ljfgseplp7pi4khhsf9g9n at 4ax.com... > > > > [Please watch the replies on this message as it's heavily > > cross-posted] > > > > I'm doing some comparisons on programming language features and I'd be > > very interested to know how you would handle the following scenarios > > in your programming language of choice. > > > > 1/ The programmer calls a function that doesn't actually exist within > > the application (or libraries). Is the a feature whereby the > > programmer can create a "catch-all" function which is called in cases > > like these? Can this function examine the list of existing functions > > and call the most appropriate one? Or create a new function on the fly > > and install it into the application? > > Smalltalk can do all of the above very easily. This general technique is > used to create generic proxies, for example. I have also played around with > "fault tolerant" apps that could automatically detect and correct spelling > errors in function calls (as a lark; never in production code). >
- Previous message (by thread): Weird Language Features
- Next message (by thread): [Q] how to protect python program from decompilation -- a better idea
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list