Sugar

Dave Herman dherman at ccs.neu.edu
Thu Aug 28 18:55:58 PDT 2008


Felix wrote:
> ingvar-sugar isn't a macro system.  it's pretty similar to python's 
> @decorator syntax.  http://www.python.org/dev/peps/pep-3129/

Yeah, you're right -- IIUC it's very much like Python decorators, though 
not class decorators but function decorators, right? IANA Python expert.

     http://www.python.org/dev/peps/pep-0318/

Ingvar, I've read your proposal more carefully. If I'm reading it right, 
I think your description is off a meta-level-- it's not so much a 
general syntactic sugar mechanism as a way of defining one specific kind 
of sugar: a function decorator. Basically, a decorator is syntactic 
sugar for function composition. The first thing I'd change is to replace 
the "sugar" keyword with "decorator." I think this would make its 
purpose clearer and connect it with precedent from other languages.

I guess I don't have much of a reaction... I understand people get a lot 
of mileage out of Python decorators, but if it came down to choosing 
between decorators and macros, I'd take macros. Regardless, I don't 
think we've been considering meta-programming facilities to be on the 
near-term agenda.

Dave


More information about the Es-discuss mailing list