From: Drew Adams <drew.adams@oracle.com>
To: Emanuel Berg <embe8573@student.uu.se>, help-gnu-emacs@gnu.org
Subject: RE: What does "lacks a prefix" mean?
Date: Sun, 12 Jul 2015 09:59:48 -0700 (PDT) [thread overview]
Message-ID: <54890979-2bf7-4665-b1d6-a147141c3dd1@default> (raw)
In-Reply-To: <87d1zydu5g.fsf@nl106-137-147.student.uu.se>
> > The problem with using `let*' all the time ("harm",
> > actually) is the problem of affixing the same
> > **WARNING** label to absolutely everything - it
> > loses all power to draw attention to anything.
> > If everwhere might involve binding dependencies then
> > you have no signal to watch for them. You need to
> > always be on the alert - or never.
> ...
> I wouldn't want a construct that says "here, there
> *might* be dependencies", instead I'd like a construct
> that said "here, there *is* a dependency, namely
> X depends on Y in terms of Z!"
That's precisely the point. I want the latter, not the former.
In your text that I elided you seem to have missed the point.
It's not about dependencies being somehow bad or dangerous or
abnormal.
It's about recognizing and understanding them. Precisely, I
imagine, why you wrote that you'd appreciate a construct that
identifies them for you. So would I.
In the absence of that, I identify them for myself, explicitly.
When I read code later I often understand it less well than I
did when I wrote it (not always, but often enough). So I as
writer try to help poor me as reader.
`let*' tells you nothing about dependencies, which means more
time examining code to understand it. That's the answer to
your question, "What does it matter?". To understand code
we sometimes need to understand what various parts of it
depend on.
Believe it or not, you do want (or will someday appreciate)
the advantage of knowing - just by looking - where there are
binding dependencies, especially if you have many bindings
at the same level (and perhaps especially if there are
dynamic bindings).
If you use only `let*' all the time then you in fact maximize
what you claim you "wouldn't want" - something that tells you
nothing about where there might be, let alone where there
actually are, dependencies.
Working code that uses `let', on the other hand, does tell
you something useful.
Lacking an automatic indication of dependencies (that would
be nice), my preference is to do the work myself when writing
code, to signal to myself (and any other reader) what my
understanding of the code is at that time:
* These particular bindings, with `let', are not themselves,
as bindings, interdependent. The code would not work if
they were (typically you'd get an unbound variable error).
* These other bindings, with `let*', _do_ involve at least
one dependency - not "might", but "do". The code would not
work if `let*' were changed to `let' here (e.g., unbound
variable error).
It's the "the code would not work" part that makes this
convention a bit more useful than, say, comments about the
writer's understanding of what's going on.
The stricter the use of the convention, the more surely does
`let*' indicate real dependencies. If adhered to strictly
then _every_ `let*' binding expresses a real, not just a
might-be, dependency.
(If you think that `let*' makes every binding depend on those
that precede it, think again. `(let* ((a 1) (b 2))...)' does
not make b's value depend on a's.)
I use `let*' where I know (or think I know) there is a binding
dependency, and `let' where I know (or think) there are none.
It's about expressing my coding-time understanding, so that a
reader has that extra bit of info - info about my thinking,
and maybe about the code.
Whether my understanding is correct when writing is not the
question. At least a reader has the advantage of knowing
what I was thinking. That's the point and, yes, it can
really help. It helps me, as writer and reader of my code.
Separating the two this way lets me know that when I see
`let*' I can rely on there being binding dependency, rather
than knowing only that there might be.
Can `let' also involve dependencies? Of course, especially
with dynamic binding. The point is not that the use of this
convention makes understanding trivial, cut-and-dried. The
point is that understanding what the writer was thinking can
help a reader.
Throwing everything into one giant `let*' is easy, and things
might seem to just work (no pesky unbound variable errors),
but it obscures rather than clarifies what is going on.
A coder knows more about the code than what an all-inclusive
`let*' can tell a reader, so I express it, to help out. In
the absence of language support that does such analysis and
proclaims the outcome in the code, I do it manually.
YMMV. You don't have to write your code the way I write
mine. And I don't have to read and maintain your code. ;-)
I do what I do because it helps me. I describe it here
because I think it could help others, even you.
next prev parent reply other threads:[~2015-07-12 16:59 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 [this message]
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
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=54890979-2bf7-4665-b1d6-a147141c3dd1@default \
--to=drew.adams@oracle.com \
--cc=embe8573@student.uu.se \
--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.