Douglas Alan <[EMAIL PROTECTED]> writes:
> People (myself included) haven't had much trouble implementing nice
> and useful macro packages for Lisp.  Admittedly, it's a harder problem
> for a language that doesn't have a Lisp-like syntax.

One very simple hack would be to define a syntax extension like

   f.(arg1,arg2,arg3)

to compile f's args into unevaluated thunks passed into f, instead of
evaluating them as expressions before calling f.  That could replace
macros and syntax extensions in some circumstances.  For example the
famous ternary operator would just be

    def ternary(cond, a, b): 
       if cond(): return a()
       else: return b()

Then you'd write, e.g.

    selection = ternary.(x > y, exp1, exp2)

without worrying about side effects of exp1 and exp2 both getting
evaluated.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to