[Python-Dev] Re: decorators and 2.4
Jeff Bone
jbone at place.org
Mon Jun 28 13:44:41 EDT 2004
On Jun 28, 2004, at 12:27 PM, David Abrahams wrote:
> I'm a big fan of declarative programs.
BTW, for the record --- I'm not under any illusions about Python's
"declarativeness." ;-)
> That said, declarativeness (especially in Python) is more a matter of
> "notational flavor" than anything we can measure. It's certainly
> independent of whether there are actual side-effects.
>
> Also, I'm suspicious of any heroic efforts to prevent language
> features from being "abused".
Let me be specific about what I'm actually worried about, here.
Specifically: I've been playing a bit with some type-inferencing stuff
and optional typing. One desiderata for decorators, per the PEP, is to
support applications like embedding type signatures and so forth into
the language, attaching them to the relevant objects. A goal could be
to support at least partial compilation with (some, and optional)
compile-time guarantees about type safety and behavior. To the extent
that decorators either (a) are evaluated conditionally based on runtime
state, or (b) modify and are in turn modified by runtime state,
decorators as mutable environments or with true side effects make a
mess of that. Perhaps you don't really want "decorators" for that ---
perhaps you want "macros." Subtle but IMHO important distinction.
NB, I'm no type Nazi. But I'd really like to see (a) Python
implemented in Python, someday --- it would make playing with all these
sorts of languages ideas and moving the language along a LOT easier,
and (b) Python compiling easily to (and running well on) arbitrary
machines or virtual machines. The more runtime / imperative /
conditional / side-effecting behavior we allow for decorators, the more
difficult both of those goals become.
Not trying (heroically or otherwise) to keep language features from
being abused as much as simply ask the question "have we REALLY thought
through the use cases, the alternatives, and their impact on the future
of the language."
jb
More information about the Python-Dev
mailing list