unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Tom Tromey <tom@tromey.com>, Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Nicolas Petton <nicolas@petton.fr>, emacs-devel@gnu.org
Subject: RE: map-put! and (setf (map-elt ...) ..) on lists
Date: Sun, 16 Dec 2018 09:37:15 -0800 (PST)	[thread overview]
Message-ID: <8b3d6cc4-43ac-48cc-be4c-917f601faa43@default> (raw)
In-Reply-To: <87y38p4ely.fsf@tromey.com>

> I wish Emacs would not adopt the Scheme "!" convention.  I find it very distracting when reading code, as if it is shouting all the time.

> Also, IMO, it's not normally the case that modifications are so important that they have to be called out; and anyway if they are, it would be better to leave this to person reading the code rather than the person writing it.

What Tom said.  But wait, there's more...

It might make some sense for Scheme, especially in
its use for teaching, but it doesn't make sense for
Lisp (er, non-Scheme Lisp, if you prefer), where
anything pure / side-effect free is the exception
rather than the rule.

Not to mention that tossing even a single impure
grain into an otherwise pure recipe can make the
entire cake you bake unclean.

Are you going to suffix the name of each function
you define with `!', to warn its users that it
might perform side effects?  Will coders hang such
"danger" signs all over the place, the `!' effect
spreading by simple contact, like a virus?

Of course not - in practice, only predefined
Scheme functions that might modify stuff get the
`!' treatment.  Consistent application of such
a convention REALLY!WOULD!RESULT!IN!CODE!THAT!
SHOUTS!EVERYWHERE!AND!ALWAYS!!!

If the goal is to forewarn users then such lack of consistency can even have the opposite effect of
lulling them into thinking they're "safe" as long
as they don't see a `!'.  Visible `!'s and hidden
`!'s ... oh my!

Misleading, at best.  Helpful for the first day of
class perhaps, but best abandoned soon thereafter,
after demonstrating the nasty, explosive contagion
of side effects (including structure modification).

Welcome to Lisp, kids.  Procedural, imperative
programming.  Hold onto your seats - things are
about to shake!

Scheme is not Haskell or lambda calculus.  And
Lisp is not Scheme (ducks for cover...).



  reply	other threads:[~2018-12-16 17:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14 17:32 map-put! and (setf (map-elt ...) ..) on lists Stefan Monnier
2018-12-16 16:32 ` Tom Tromey
2018-12-16 17:37   ` Drew Adams [this message]
2018-12-16 18:20     ` Stefan Monnier
2018-12-16 23:06       ` Tom Tromey
2018-12-17  3:16         ` Stefan Monnier
2018-12-17  4:08       ` Stefan Monnier
2018-12-17 11:41         ` Nicolas Petton
2018-12-17 16:06           ` Eli Zaretskii
2018-12-17 16:07           ` Drew Adams
2018-12-18 10:11             ` Nicolas Petton
2018-12-18 13:56               ` Stefan Monnier
2018-12-18 15:42                 ` Drew Adams
2018-12-18 15:34               ` Drew Adams
2018-12-18 15:47                 ` Stefan Monnier
2018-12-18 16:34                 ` Nicolas Petton
2018-12-18 17:41                   ` Drew Adams
2018-12-18 20:44                     ` Nicolas Petton
2018-12-16 18:21     ` Stefan Monnier
2018-12-17 11:38 ` Nicolas Petton

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b3d6cc4-43ac-48cc-be4c-917f601faa43@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=nicolas@petton.fr \
    --cc=tom@tromey.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).