all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Thorpe <rt@robertthorpeconsulting.com>
To: help-gnu-emacs@gnu.org
Cc: Yuri Khan <yuri.v.khan@gmail.com>
Subject: Re: What does "lacks a prefix" mean?
Date: Sun, 19 Jul 2015 01:59:21 +0100	[thread overview]
Message-ID: <87lhed0xp2.fsf@robertthorpeconsulting.com> (raw)
In-Reply-To: <CAP_d_8UDKEZQVf18z-P0M4U0L-ZeMTp34YGRnRoukTV-YQqREg@mail.gmail.com> (message from Yuri Khan on Tue, 14 Jul 2015 12:23:55 +0600)

Yuri Khan <yuri.v.khan@gmail.com> writes:

> 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.

For what it's worth, this is my opinion on let vs let*.

When there's a dependency between two of the variables I use let*.  If
there's no dependency at all I use let.  So, if the code defining y
depends on the code defining x then I use let*.

I don't like the style where let* is used for everything.  Here's an
example of the problem.  Suppose you're reading through a function.  You
have a local variable z and you want to understand what values it could have.
To begin with you want to understand what could happen at the beginning
of the body of the let statement z is defined in.

I.e.:-
(defun foo ()
 "blah blah"
 (let* ((a (something))
       (b (something-else ...))
       (z (something-more)))
 ... here...
 ...rest of the code...)

Now, let's say the programmer has used let.  In that case I know by
looking that I don't have to read the definitions of a & b.
Alternatively, suppose the programmer has used let* even though z isn't
dependent on a or b.  In that case let* indicates to me the reader that
they should read the definitions of a & b.  But, doing that isn't
immediately necessary, I may not need to understand the details of a & b
to understand the problem.

It's easy to be critical of the process of restructuring or refactoring
code.  It's inevitable in large codebases though.  The cost and time of
rewriting them is simply too large.  Even if the original is badly
written it generally contains undocumented features that people rely on.
If a large program is well written that doesn't mean it won't need
modifications regularly.

BR,
Robert Thorpe



  parent reply	other threads:[~2015-07-19  0: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
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 [this message]
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=87lhed0xp2.fsf@robertthorpeconsulting.com \
    --to=rt@robertthorpeconsulting.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=yuri.v.khan@gmail.com \
    /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.