Michael Chermside wrote:
I've been following this conversation, and it sounds to me as if we
are stumbling about in the dark, trying to feel our way toward something
very useful and powerful. I think Jim is right, what we're feeling our
way toward is macros.
I considered saying something like that
Michael Chermside wrote:
if the answer is that we want to prohibit nothing, then the right
solution is macros.
I'm not sure about that. Smalltalk manages to provide very
reasonable-looking user-defined control structures without
using compile-time macros, just normal runtime evaluation
together
[ Michael Walter ]:
A couple of examples out of my tired head (solely from a user perspective) :-)
Embedding domain specific language (ex.: state machine):
...
Embedding domain specific language (ex.: markup language):
...
Embedding domain-specific language (ex.: badly-designed
(3) Add macros. We still have to figure out how to limit their
obfuscation.
nobody has given even a *remotely*
plausible mechanism for how exactly you would get code executed at
compile time.
macros can (and *possibly* should) be evaluated at run-time.
We must still have very
Jim Jewett wrote:
I had been thinking that the typical use would be during function (or
class) definition. The overhead would be similar to that of decorators,
and confined mostly to module loading.
But that's too late, unless you want to resort to bytecode
hacking. By the time the module is
Jim Jewett writes:
As best I can tell, the anonymous blocks are used to take
care of boilerplate code without changing the scope -- exactly
what macros are used for.
Folks, I think that Jim is onto something here.
I've been following this conversation, and it sounds to me as if we
are
Michael Chermside wrote:
Jim Jewett writes:
As best I can tell, the anonymous blocks are used to take
care of boilerplate code without changing the scope -- exactly
what macros are used for.
Folks, I think that Jim is onto something here.
I've been following this conversation, and it sounds to me
On Mon, Apr 25, 2005, Shane Holloway (IEEE) wrote:
Interfaces::
def interface(interfaceName, *bases, ***aBlockSuite):
blockGlobals = aBlockSuite.globals().copy()
blockGlobals.update(aBlockSuite.locals())
blockLocals = {}
exec aBlock in blockGlobals,
Guido:
My problem with macros is actually more practical: Python's compiler
is too dumb. I am assuming that we want to be able to import macros
from other modules, and I am assuming that macros are expanded by the
compiler, not at run time; but the compiler doesn't follow imports ...
Guido writes:
My problem with macros is actually more practical: Python's compiler
is too dumb. I am assuming that we want to be able to import macros
from other modules, and I am assuming that macros are expanded by the
compiler, not at run time; but the compiler doesn't follow imports
(that
Robert Brewer wrote:
So currently, all subclasses just override __set__, which leads to a
*lot* of duplication of code. If I could write the base class' __set__
to call macros like this:
def __set__(self, unit, value):
self.begin()
if self.coerce:
value =
Shane Hathaway wrote:
Robert Brewer wrote:
So currently, all subclasses just override __set__, which leads to a
*lot* of duplication of code. If I could write the base
class' __set__
to call macros like this:
def __set__(self, unit, value):
self.begin()
if
On 4/25/05, Guido van Rossum [EMAIL PROTECTED] wrote:
It could also be done (though not as cleanly) by making macros act as
import hooks.
Brrr. What about imports that aren't at the top level (e.g. inside a
function)?
Bad style already. :D
If you want to use the macro, you have to ensure
It seems that what you call macros is really an unlimited
preprocessor. I'm even less interested in that topic than in macros,
and I haven't seen anything here to change my mind.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Robert Brewer wrote:
I still prefer more methods, because my actual use-cases are more
complicated. Your solution would work for the specific case I gave, but
try factoring in:
* A subclass which needs to share locals between begin and post, instead
of pre and post.
or
* A set of 10
Robert Brewer wrote:
Shane Hathaway wrote:
Robert Brewer wrote:
So currently, all subclasses just override __set__, which leads to a
*lot* of duplication of code. If I could write the base
class' __set__
to call macros like this:
def __set__(self, unit, value):
self.begin()
if
As best I can tell, the anonymous blocks are used to take
care of boilerplate code without changing the scope -- exactly
what macros are used for. The only difference I see is that in
this case, the macros are limited to entire (possibly compound)
statements.
To make this more concrete,
17 matches
Mail list logo