[Top][All Lists]

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

Re: while break and continue

From: Marius Vollmer
Subject: Re: while break and continue
Date: 19 Jun 2003 00:56:55 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Kevin Ryde <address@hidden> 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

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

> 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

reply via email to

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