Metaclass with name overloading.

Carlos Ribeiro carribeiro at gmail.com
Tue Sep 28 23:28:45 CEST 2004


On 28 Sep 2004 21:07:27 GMT, Bengt Richter <bokr at oz.net> wrote:
> On Tue, 28 Sep 2004 14:37:31 +0200, aleaxit at yahoo.com (Alex Martelli) wrote:
> [...]
> >
> >At this point, your templating is not declarative -- it's imperative.
> >Like everything in Python, btw -- not ONE 'declarative' in sight (except
> >the 'global' statement, which is part of what makes it a wart;-).
> 
> Hm ;-) Is a module source a declaration of (imperative) intent, passive until imported?
> ISTM we are getting into shades of semantics. Interesting though ;-)
> For a language that plays well both ways, I would try scheme or lisp, I think.

I was just about to reply to Alex, but managed to stop my fingers.
It's indeed a fine line, and I'm not enough of an academicist to
discuss it with all detail it deserves. We could go on weeks debating
it here (and I'm afraid we do). Broadly speaking, my take is as
follows:

Class definitions are executed (imperative), but are normally used to
store definitions (that's declarative, in a broad sense). I think
that's exactly what has attracted me to this kind of 'hack'. The
ability to write intelligent, complex, hierarchic data structures
seamlessly intermingled with code. Templating languages or XML fall
short in this respect. If you really want to *integrate* them both --
and I'm not talking about simply reading static resource files here --
either you have a cross beast that is data based but has some
imperative statements interspersed with a clumsy syntax, or you have
source code filled with unneeded clutter to manage the data
manipulation part, in a rather obstrusive way to the logic of the
system.

(XML based systems use complex parsers to work with the data. It's not
possible, in most cases, to include enough intelligence in the data
stream itself for it to instruct the parser to do something
"different" -- unless you care to define your own language to do it,
and that's clumsy, at best, given XML "great" readability).

-- 
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com



More information about the Python-list mailing list