Is classless worth consideration

has has.temp2 at virgin.net
Sat May 1 15:38:24 EDT 2004


huy <nytimes at swiftdsl.com.au> wrote in message news:<409387a1$0$27649$61ce578d at news.syd.swiftdsl.com.au>...

> So were does the actual *file* that the source code sits in fit in this 
> classification of yours ?

In AppleScript - which I'm using both because I know it well and
because, despite its many other flaws, it does this  particular stuff
fairly well - a file represents a script object, just like it
represents a module object in Python. Essentially just a portable
namespace. The difference, of course, is that AppleScript's script
objects aren't limited to _only_ being used as modules. Which means,
for example, you can load one script into the other and use the loaded
script either as a module or as a clonable prototype in OOP.

Other points of interest regarding the model AS uses...

Note that there are two file types used in AS: *.applescript, which is
the script in source code form, and *.scpt, which is the script in a
bytecode-compiled, persistent form (an idea it probably got from
Smalltalk). Unlike .pyc files, however, which are only intended for
execution, .scpt files are also intended to be opened, edited, and
otherwise used and abused by their users, and are the form most
scripts are stored in. The AS runtime simply provides complementary
compile() and decompile() routines for editing tools to call, unlike
most other scripting languages which tend only to provide the former.

Of course, this combination of 'one-size-fits-all' generic script
object and highly pervasive object persistence as standard means you
can easily go the other direction too, storing script objects to file
for use as, say, modules themselves. My HTMLTemplate/AppleScript
library does this, for example; template compilation takes several
seconds there (AS sucks for speed), so I simply added code to the base
'Template' node that makes it compatible with my library Loader
system, and now you can compile an HTML template into a custom AS
object model, store it to disk as a module (either as a component to a
larger program or a standalone library in the standard library system
I've set up), then load it up into another script any time you want to
run off a few webpages.


BTW, if anyone with a Mac wants to check it out, all my libraries and
the library Loader system are under new management at
applemods.sourceforge.net. Mind that it's not hugely powerful or
sophisticated stuff compared to what other languages offer, but that
was by design (i.e. AS users have modest needs) not due to language
limitations. What is of note is just how very few language features I
needed to set this system up. I still had to learn all the theory
behind modular and OO systems to design it, of course, but very little
language-specific knowledge was needed to put that into effect.

Which I suppose is really my point: I'd rather fill my head with
valuable knowledge of how to design software systems, than clog it up
with lots of fiddly little implementation-specific details and trivia.
The amount of complexity my mind can manage is pretty limited to most
of yours, so I like to get best bang for my buck I can. :)

HTH



More information about the Python-list mailing list