[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs lisp syntax rfc: (cond (EXPR => (lambda (X) ...)))

From: Stefan Monnier
Subject: Re: emacs lisp syntax rfc: (cond (EXPR => (lambda (X) ...)))
Date: Wed, 05 Jan 2011 19:10:42 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> However, it seems to me that we are now coming up with rather
> convoluted schemes in which scoping become far from obvious,
> especially to someone unfamiliar with this particular lisp.

Agreed.  A slightly more sane syntax could be

   (foo bar)
   (:let var exp1)
   (exp2 bla... var ...bla)
   (bli... var ...bli) ...)

but it's still not very convincing.

> Also, I wonder what is so special about cond, anyhow?

It's often useful to use cond to syntactically list
various alternatives.  But if some of conds need the same sub-expression
and that sub-expression is not always computed, you get into a funny
situation where you need to use

  (let (var)
    (setq var ...)

I.e. separate the declaration of a variable from its initialization,
which is ugly and introduces side-effects even for a variable which
often could/should really be immutable.

Lazy languages solve this by letting the user do

   (let ((var exp1))

and have exp1 only evaluated the first time var is used.  But we don't
want to add laziness, do we?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]