Greg Wilson wrote: > > > > > 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. I don't think mixing compilation with execution is a good idea. If we ever want to add this feature, we can always use a pragma for it ;-) ... def mysettings(compiler, locals, globals, target): compiler.setoptimization(2) # Call the above hook for every new compilation block pragma compiler_hook = "mysettings" -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4