all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Garreau\, Alexandre" <galex-713@galex-713.eu>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Why is there no `until' in elisp?
Date: Wed, 17 Oct 2018 11:14:38 +0200	[thread overview]
Message-ID: <87pnw9gcjl.fsf@portable.galex-713.eu> (raw)
In-Reply-To: <jwvh8hlz6d7.fsf-monnier+gmane.emacs.devel@gnu.org> (Stefan Monnier's message of "Tue, 16 Oct 2018 22:04:10 -0400")

On 2018-10-16 at 22:04, Stefan Monnier wrote:
>> I think `until' should refer to the version I gave because this is
>> probably the one which is going to be implemented naively by most people,
>
> I completely reject this kind of argument.
>
> By that argument, we should avoid lexical scoping since dynamic scoping
> is "the one which is going to be implemented naively by most people".

I think you misunderstood me: that’d mean dynamic scoping is something
to implement and keep aside and not remove when implementing lexical
scoping, not that lexical scoping shouldn’t exist.  I said it, I find
your `until' very interesting, so it ought to exist even maybe with a
not-longer name.

It maybe could be an argument against default lexical scoping, while I’m
not against that (afaik it’s only for backward compatibility that emacs
keeps it as default right?), but then I think I should extend my
statement to support what independant experience says, and apply what I
said only to experiences about untested-enough things.

>> also it can be useful to try to retrieve the last body return
>> value, just as it is with `while':
>
> The body of those loops is made of side-effecting operations.
> Usually side-effecting operations don't have useful return values.

They might, but indeed less probably than the cond, so this is a point.
Yet I might notice a cond might usually return a simple t/nil boolean
(for instance when using comparison functions such as (< 1 2), which
keep returning t instead of one of its arguments), which, in case of
`until'/`while', will be known in advance.

>> And then, of course, this introduce useless discrepancy toward
>> symmetry within respect `while'.
>
> No discrepancy: it makes `until` return the value of its last test, just
> like `while` already does (with `while` that value is always nil).

No, `while' currently returns its last body, I just checked:
(let ((x 0)) (while (< x 5) (setq x (+ 1 x))) 8))

Anyway for the non-`while1'/non-`until1' (let’s call them
`whilen'/`untiln' for the sake of speaking) I was talking about a
default `while' (and `until') that would return its cond when there’s no
body, if the working is similar as to `progn' as I stated.



  reply	other threads:[~2018-10-17  9:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 17:42 Why is there no `until' in elisp? Garreau, Alexandre
2018-10-16 19:16 ` Eric Abrahamsen
2018-10-16 19:31   ` Garreau, Alexandre
2018-10-16 20:23     ` Eric Abrahamsen
2018-10-16 23:00       ` Garreau, Alexandre
2018-10-19 15:28   ` Stefan Monnier
2018-10-16 21:28 ` Stefan Monnier
2018-10-17  0:12   ` Garreau, Alexandre
2018-10-17  2:04     ` Stefan Monnier
2018-10-17  9:14       ` Garreau, Alexandre [this message]
2018-10-17 15:06         ` Stefan Monnier
2018-10-17 16:51           ` Garreau, Alexandre
2018-10-19 15:34     ` Stefan Monnier
2018-10-19 18:08       ` Garreau, Alexandre
2018-10-17  8:04   ` Yuri Khan
2018-10-17  9:23     ` Garreau, Alexandre
2018-10-17  9:46       ` Yuri Khan
2018-10-17 11:06         ` Garreau, Alexandre
2018-10-17 17:50         ` Paul Eggert
2018-10-17 21:15           ` Garreau, Alexandre
2018-10-17 21:35             ` Paul Eggert
2018-10-17 21:49               ` Garreau, Alexandre
2018-10-17 22:33                 ` Paul Eggert
2018-10-17 22:54                   ` Garreau, Alexandre
2018-10-17 12:41     ` Elias Mårtenson
2018-10-17 15:03     ` Stefan Monnier

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=87pnw9gcjl.fsf@portable.galex-713.eu \
    --to=galex-713@galex-713.eu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.