all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Barzilay <eli@barzilay.org>
To: rms@gnu.org
Cc: emacs-devel@gnu.org
Subject: Re: proposal to make null string handling more emacs-y
Date: Sat, 28 Apr 2012 17:56:22 -0400	[thread overview]
Message-ID: <20380.26502.202440.851555@winooski.ccs.neu.edu> (raw)
In-Reply-To: <E1SOB26-0006Fh-3w@fencepost.gnu.org>

Four hours ago, Richard Stallman wrote:
>     As a (semi-fake) "Schemer", I can say that it's perfectly fine in
>     practice too.  It catches real errors.  In analogy to what you wrote a
>     few seconds later -- it catches errors that would otherwise get
>     papered over.
> 
> The benefit of making () and false the same in Lisp is NOT a matter
> of suppressing errors.

Sure it is.  (null? (< 1 2)) makes no semantic sense, and you get an
error.  In other lisps, (null (< 1 2)) makes no sense but instead of
an error you get a convention of preferring `not'.  The error that
Scheme throws is suppressed, but using `null' like that is likely to
be an error.  (BTW, Scheme itself is doing the same when it treats any
non-#f value as true.  CLers would also argue that Scheme is also
doing it when it treats identifiers in function positions the same as
elsewhere.)


> The benefit is that we can simplify programs by knowing that () and
> false are the same.

Right, and you get more of these benefits if it's also the same as ""
and as 0, and there are additional benefits in the same direction:
allow using `nil' as a function (that returns `nil' when called),
allow adding numbers, strings, lists, etc with implicit coercions,
maybe allow using numbers and lists as functions (as in arc), and
allow referring to undefined variables and calling undefined
functions.

Each of these simplifies (and shortens) existing code, since they each
encapsulate common code pattern.  But each of these suppresses more
bugs since more defective code runs to completion, returning bogus
results instead of throwing an error.  (I'm talking about defective in
the sense of diverging from what the code should do, not in a
technical execution sense where they're no longer bugs.)

Note in particular that all of these are directly contributing to
Steve's proposal: they lead to less frustraing errors, since more code
will run without exceptions, implicitly doing something that likely
should be done in today's elisp.  Note also his reference to running
code in a browser, where JS is a language that is very intentionally
doing its best to continue running, with modern browsers going farther
by not even showing most people errors.

Arguing that some of these things are better or worse is wrong.  It
doesn't make sense to reject unifying "" and `nil' on one hand and
reject separating false and '() on the other -- *unless* it's clear
that it's a subjective decision.  They are very clearly tradeoffs of
convenience vs robustness.

So the argument is not "scheme is wrong to distinguish false from nil,
elisp is right to distinguish the empty string from nil".  Instead, it
should be an argument about the decision that most elispers do, and
finding the right place on the line.


> Equating () and "" might perhaps give some benefit of simplifying
> programs.  You could try looking for places where you could take
> advantage of that, to see how much convenience it gives.  But this
> is a different matter from avoiding errors.

(Avoiding errors is what started this thread...)


> I tend to think the benefit won't be big, but you can try to show
> I'm wrong.

(I'm making a meta point about the argument, I don't have any
preference for either side.)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!



  parent reply	other threads:[~2012-04-28 21:56 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-25  0:24 proposal to make null string handling more emacs-y Steve Yegge
2012-04-25  4:45 ` Karl Fogel
2012-04-25  6:28 ` Miles Bader
2012-04-25  6:34   ` Miles Bader
2012-04-25 13:21   ` Ted Zlatanov
2012-05-01 22:01     ` Randal L. Schwartz
2012-04-25  7:53 ` Helmut Eller
2012-04-25  8:22 ` Eli Zaretskii
2012-04-25 14:28   ` Stefan Monnier
2012-04-25 14:35     ` Eli Zaretskii
2012-04-25 15:30       ` Stefan Monnier
2012-04-25 16:41         ` Miles Bader
2012-04-25 16:45         ` Andreas Schwab
2012-04-25 16:46         ` Juanma Barranquero
2012-04-26 21:20         ` Steve Yegge
2012-04-26 22:11           ` Miles Bader
2012-04-26 23:52             ` Steve Yegge
2012-04-27  0:29               ` Miles Bader
2012-04-27  3:20                 ` Jeremiah Dodds
2012-04-27  3:41                   ` Miles Bader
2012-04-27  3:59                     ` Jeremiah Dodds
2012-04-27  4:24                       ` Miles Bader
2012-04-27  8:49                         ` Thien-Thi Nguyen
2012-04-27 14:23                         ` Nix
2012-04-28  2:07                         ` Better startup error handling (was: proposal to make null string handling more emacs-y) Stefan Monnier
2012-04-28 12:04                           ` Better startup error handling Nix
2012-04-28 15:16                             ` Stefan Monnier
2012-04-28 15:42                               ` David Engster
2012-04-28 15:55                               ` Drew Adams
2012-04-28 19:39                                 ` Stefan Monnier
2012-04-28 17:26                           ` Lars Magne Ingebrigtsen
2012-04-30  8:43                           ` Christian Lynbech
2012-04-30  9:18                             ` chad
2012-04-27 16:35                   ` proposal to make null string handling more emacs-y Richard Stallman
2012-04-27  1:10           ` Stefan Monnier
2012-04-27  1:16             ` Lars Magne Ingebrigtsen
2012-04-27 16:35               ` Richard Stallman
2012-04-28 11:13                 ` Eli Barzilay
2012-04-28 17:02                   ` Richard Stallman
2012-04-28 19:48                     ` Stefan Monnier
2012-04-28 21:56                     ` Eli Barzilay [this message]
2012-06-03  3:45                       ` Richard Stallman
2012-04-27  4:17             ` Steve Yegge
2012-04-27  6:36               ` Eli Zaretskii
2012-04-27 19:05                 ` Steve Yegge
2012-04-27 21:24                   ` Drew Adams
2012-04-28  4:43                     ` Steve Yegge
2012-04-28  6:58                       ` Andreas Schwab
2012-04-29 21:26                   ` Odd formatting (was: proposal to make null string handling more emacs-y) Lars Magne Ingebrigtsen
2012-04-30  7:48                     ` Odd formatting Steinar Bang
2012-04-30 10:14                       ` Antoine Levitt
2012-04-30 13:27                         ` Nix
2012-04-28  2:02               ` proposal to make null string handling more emacs-y Stefan Monnier
2012-04-25 14:51 ` Lars Magne Ingebrigtsen
2012-04-29 17:00 ` Andreas Röhler
2012-04-29 17:08   ` Drew Adams
2012-04-29 17:29     ` Andreas Röhler
2012-04-29 18:01       ` Drew Adams
2012-04-29 19:51       ` PJ Weisberg

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=20380.26502.202440.851555@winooski.ccs.neu.edu \
    --to=eli@barzilay.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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.