unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Marius Vollmer <mvo@zagadka.de>
Subject: Re: while break and continue
Date: 19 Jun 2003 00:56:55 +0200	[thread overview]
Message-ID: <87n0gf0zbc.fsf@zagadka.ping.de> (raw)
In-Reply-To: <878yshe1ux.fsf@zip.com.au>

Kevin Ryde <user42@zip.com.au> writes:

> The code is still pretty ugly, I suppose that's what you get for
> non-local exits :-).  Maybe should have a caveat in the docs about
> style, to discourage their use.

Discourage the use of 'while' or merely 'continue' and 'break'?  I
think, pointing in the docs of 'while' to 'do' and the other ways of
doing loops in Scheme would be good.

I do think we definitely need to efficiently support non-Schemey
styles, for the translators and maybe also for people used to them.
But that should probably be done together with a compiler so that the
common usage can be properly optimized.  (A 'while' that doesn't use
'break' should not have a 'catch', etc...)

Your macro is not necessarily he most efficient, but it is as
efficient as possible without some kind of comiler-style analysis, I'd
say.

What is more important is the interface: does it have the right
semantics?  I think it does, and we should change our old while to
your new version, even if the implementation is ugly and maybe
inefficient.

> I wonder if the value parameter for break should be optional, and
> have while return unspecified when not given.  That might be a
> reasonably common usage.

I think the value of a while loop is ill-specified anyway and we
should always return unspecified.  What should be returned when the
condition becomes false?  Your macro arranges to return #t, wich seems
arbitrary.  People who want their loop to return a specific value
should use 'do', named 'let', or some other mechanism, I'd say.

> Unless the whole thing is emulating some established
> convention.

Not that I know of.

> Incidentally, where would be a good place to put some tests?
> syntax.test maybe, or a new file?

syntax.test seems fine.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2003-06-18 22:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-30  0:00 while break and continue Kevin Ryde
2003-06-01 23:58 ` Marius Vollmer
2003-06-05  1:42   ` Kevin Ryde
2003-06-18 22:56     ` Marius Vollmer [this message]
2003-06-21 23:28       ` Kevin Ryde
2003-07-27 14:48         ` Marius Vollmer
2003-07-29  0:23           ` Kevin Ryde
2003-08-13 21:49             ` Kevin Ryde
2003-08-13  9:27               ` Matthias Koeppe
2003-08-14 23:35                 ` Kevin Ryde
2003-08-15  1:43                 ` Kevin Ryde
2003-06-06 22:31   ` Kevin Ryde
2003-06-18 22:57     ` Marius Vollmer
2003-06-20 23:56       ` Kevin Ryde

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/guile/

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

  git send-email \
    --in-reply-to=87n0gf0zbc.fsf@zagadka.ping.de \
    --to=mvo@zagadka.de \
    /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.
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).