From: Yuri Khan <yuri.v.khan@gmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: What does "lacks a prefix" mean?
Date: Tue, 14 Jul 2015 12:23:55 +0600 [thread overview]
Message-ID: <CAP_d_8UDKEZQVf18z-P0M4U0L-ZeMTp34YGRnRoukTV-YQqREg@mail.gmail.com> (raw)
In-Reply-To: <87lhej62nl.fsf@nl106-137-147.student.uu.se>
On Tue, Jul 14, 2015 at 5:47 AM, Emanuel Berg <embe8573@student.uu.se> wrote:
> If you are to muck around with old code, which seldom
> is a good idea but sometimes necessary (?),
Why the (?)? Mucking around with old code is necessary every time you
want to add a feature or debug a failure.
> then doing
> so will be helped to an unfathomable degree if the
> "let* style" has been applied when the code was
> originally written, as computation is stepwise
> performed and each step is named and put neatly into
> a nice looking column!
>
> It is, on the contrary, the "let style" with
>
> (let ((entity (computation_1 (computation_2 ( ... )))))
> ... )
>
> which is much more difficult to write, not to mention
> read, debug, and later maintain and modify.
You’re putting out a strawman by comparing a “let* style” where small
expressions are given names and arranged in a total order with a “let
style” where few names are bound to independent but huge expressions.
The ultimate degree of the “let*” style you describe is code compiled
to assembly. (For the sake of argument, let’s assume a machine with
ten thousand registers, so that we don’t have to argue about register
reuse.) Expressions are very simple but it becomes hard to give them
meaningful names. Additionally, evey modern compiler worth its bits
will interleave independent evaluations if it will help saturate the
CPU pipelines. The resulting code is very complicated — the code is
doing several things at once and one has to unscramble it in order to
reason about it.
The ultimate degree of the “let style” you describe is the UNIX shell
pipeline. Its two main problems are: (1) lack of names for
intermediate values, (2) each unnamed intermediate value can only be
used once. As soon as you want to reuse the result of a subexpression,
you need to give it a name.
As in most things, there is a golden middle where the expressions are
not too complex, names are meaningful enough, and related computations
are clustered together. When structured like this, code is a pleasure
to work with.
> "Variable dependencies" is all schoolbook stuff -
> forget about it, the sooner the better, because it
> doesn't work like that. It doesn't increase
> "complexity", whatever that is.
Schoolbook stuff? No, we were not taught about dependencies at school.
We were taught recipes. Here is how you add, subtract, multiply and
divide; this is how you use standard library functions; this is how
you define your own functions. Oh actually in <this particular
language> you can’t define your own functions; too bad, you’ll have to
make do with subroutines and instead of returning a result assign it
into a global variable.
This is where complexity comes from: people knowing recipes and
applying them out of scale until the code is too complicated to fit in
one head. Especially, code written by a person with an exceptionally
big head will not fit in an average head.
Maybe you can keep 15 named variables and 60 unnamed intermediate
values in your head and reason about them freely. I cannot. I need
devices that help me in that. These devices can be embedded in the
code (meaningful names, auxiliary functions, and/or an occasional
comment) or I can work it out on a sheet of paper, throw it away when
done and have to redo it again the next time.
next prev parent reply other threads:[~2015-07-14 6:23 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 16:32 What does "lacks a prefix" mean? BobD
2015-07-08 16:45 ` Barry Margolin
2015-07-08 16:59 ` Vaidheeswaran C
2015-07-08 17:10 ` Vaidheeswaran C
2015-07-08 18:17 ` BobD
2015-07-08 18:21 ` Pascal J. Bourguignon
2015-07-08 18:45 ` BobD
2015-07-08 23:24 ` Emanuel Berg
2015-07-09 15:23 ` Filipp Gunbin
2015-07-09 22:32 ` Emanuel Berg
2015-07-10 17:04 ` Stefan Monnier
2015-07-11 22:42 ` Emanuel Berg
[not found] ` <mailman.6748.1436654668.904.help-gnu-emacs@gnu.org>
2015-07-11 23:58 ` Barry Margolin
2015-07-13 12:26 ` Filipp Gunbin
[not found] ` <mailman.6685.1436547891.904.help-gnu-emacs@gnu.org>
2015-07-10 18:27 ` Barry Margolin
[not found] ` <mailman.6612.1436455429.904.help-gnu-emacs@gnu.org>
2015-07-09 23:27 ` Barry Margolin
[not found] ` <mailman.6643.1436488423.904.help-gnu-emacs@gnu.org>
2015-07-10 0:49 ` Pascal J. Bourguignon
2015-07-10 5:04 ` Drew Adams
2015-07-10 14:42 ` Barry Margolin
[not found] ` <<barmar-2BC802.10421910072015@88-209-239-213.giganet.hu>
2015-07-10 14:53 ` Drew Adams
[not found] ` <<barmar-500871.19271109072015@88-209-239-213.giganet.hu>
2015-07-10 0:33 ` Drew Adams
[not found] ` <mailman.6590.1436397914.904.help-gnu-emacs@gnu.org>
2015-07-09 14:01 ` Barry Margolin
2015-07-09 14:10 ` Rusi
2015-07-09 22:27 ` Emanuel Berg
[not found] ` <mailman.6639.1436481016.904.help-gnu-emacs@gnu.org>
2015-07-10 3:10 ` Rusi
2015-07-10 16:00 ` Emanuel Berg
2015-07-09 22:19 ` Emanuel Berg
[not found] ` <<barmar-F23189.10014209072015@88-209-239-213.giganet.hu>
2015-07-09 15:33 ` Drew Adams
2015-07-12 1:47 ` Emanuel Berg
2015-07-12 16:59 ` Drew Adams
2015-07-13 0:46 ` Emanuel Berg
2015-07-13 7:26 ` Yuri Khan
2015-07-13 23:47 ` Emanuel Berg
2015-07-14 6:23 ` Yuri Khan [this message]
2015-07-14 21:58 ` Emanuel Berg
2015-07-19 0:59 ` Robert Thorpe
2015-07-28 0:24 ` Emanuel Berg
2015-07-30 1:40 ` Robert Thorpe
[not found] ` <mailman.7638.1438220428.904.help-gnu-emacs@gnu.org>
2015-07-30 2:49 ` Rusi
2015-07-30 2:53 ` Rusi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAP_d_8UDKEZQVf18z-P0M4U0L-ZeMTp34YGRnRoukTV-YQqREg@mail.gmail.com \
--to=yuri.v.khan@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.