[Python-Dev] Re: pragmas as callbacks

Greg Wilson gvwilson@nevex.com
Tue, 29 Aug 2000 13:21:52 -0400 (EDT)


> > > Marc-Andre Lemburg wrote:
> > > I'd rather not add complicated semantics to pragmas -- they should be
> > > able to set flags, but not much more.

> > Greg Wilson writes:
> > Pragmas are a way to give instructions to the interpreter; when you let
> > people give something instructions, you're letting them program it, and I
> > think it's best to design your mechanism from the start to support that.

> Marc-Andre Lemburg:
> I don't get your point: you can "program" the interpreter by
> calling various sys module APIs to set interpreter flags already.
> 
> Pragmas are needed to tell the compiler what to do with a
> source file. They extend the command line flags which are already
> available to a more fine-grained mechanism. That's all -- nothing
> more.

Greg Wilson writes:
I understand, but my experience with other languages indicates that once
you have a way to set the parser's flags from within the source file being
parsed, people are going to want to be able to do it conditionally, i.e.
to set one flag based on the value of another.  Then they're going to want
to see if particular flags have been set to something other than their
default values, and so on.  Pragmas are a way to embed programs for the
parser in the file being parsed.  If we're going to allow this at all, we
will save ourselves a lot of future grief by planning for this now.

Thanks,
Greg