help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: What does "lacks a prefix" mean?


From: Emanuel Berg
Subject: Re: What does "lacks a prefix" mean?
Date: Sun, 12 Jul 2015 00:42:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> let* says "I need variables which depend on each
>> other" and if they're really not, that
>> look strange.
>
> If let behaved like let* it wouldn't look strange to
> you. Many other functional languages dropped the
> "simultaneous let" and only kept the equivalent of
> let* (or even letrec).
>
>> And probably it's a bit slower.
>
> Regarding efficiency, there's no clear winner
> between the two. It's basically irrelevant.
>
>> And non-parallelizable theoretically :)
>
> In practice neither is easily parallelizable anyway.
> And the work needed to auto-convert a "let*" to
> a "let" when possible is trivial in comparison to
> what's needed to parallelize the code. So again,
> it's really irrelevant.

Hear? I couldn't have said it better myself. Wait...
I couldn't! But let me say a couple of other things:

1) "let" looks better and is faster to type, both in
   terms of the number of chars used and what those
   chars are (i.e., no "*" in "let" which is only
   normal letters).

2) With the let/let* distinction, while let* being the
   oddball, it sends the signal that the "let" style,
   and not the one of "let*", is the one preferred.
   But it is actually the "let*" style that should be
   favored! It is much more clear and
   easily navigated. Compare:

        (setq side 3.0)

        (let ((cube-volume (* side side side)))
          cube-volume)

   vs.

        (let* ((side 3.0)
               (side-area   (* side side))
               (cube-volume (* side-area side)) )
          cube-volume)

    "Dependencies" are the most natural things and
    aren't anything to be afraid of! Only if you are
    the manager of a Linux distro they can get out of
    hands sometimes...

3) "let", if let was let*, would be less thinking in
   advance since then you wouldn't have to think "so,
   will I have variables now which will depend on
   each other?" You'd just type "let" in either case!
   Likewise, when you modify code long after you
   first wrote it, you often insert a new variable
   that is "dependent" on another, and then you have
   to change the `let' to `let*'. But this is very
   easy to forget and it is always a silly mistake
   when it happens.

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

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