emacs-devel
[Top][All Lists]
Advanced

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

RE: map-put! and (setf (map-elt ...) ..) on lists


From: Drew Adams
Subject: RE: map-put! and (setf (map-elt ...) ..) on lists
Date: Sun, 16 Dec 2018 09:37:15 -0800 (PST)

> 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 via email to

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