[Top][All Lists]

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

Re: Always using let*

From: Emanuel Berg
Subject: Re: Always using let*
Date: Sun, 14 Sep 2014 23:41:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Drew Adams <address@hidden> writes:

>> Would it be OK to always use let*? I was just bitten
>> by the fact that with let you can not previous
>> variables from the let statement, as is possible
>> with setq. So I am thinking about always using let*,
>> so I do not have to think about it. Or are there
>> good reasons to use let when you do not need let*?
> The most common reason is when you want to use a
> variable value in the cadr of a binding and you do
> *not* want to pick up the variable's newly bound
> value. IOW, precisely the opposite use case of what
> you wanted when you were bit.
> (setq c 3)
> (let ((c (+ c 4)) (b (* c 42)))

Correct, but isn't that only confusing style?

Isn't it better to call the c in the let something

The only reason I don't always use let* is that it is
slower type, looks awkward, and that other people
reading the code will wonder: "why `let*'? there is
nothing reoccurring!"

> (The other reason is that for some Lisps the bindings
> of `let' can be done in parallel, which can be
> quicker.)

Oh yeah?! Like parallel on a multicore computer? I only
have single CPU so I can't test but that would be
downright awesome.

However let* could also in part run in parallel for the
clauses that don't have precedence constraints (i.e.,
for wich the let* isn't necessary).

underground experts united

reply via email to

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