[plt-scheme] minor WHEN and UNLESS question
Looks to me like something that perhaps was planned?
I think that the main point of the documentation should be that *you*
shouldn't use the result of `when'/`unless', because it might be void
(not #f, btw). If the forms need to always return void, then the
implementation will not have the subform in a tail-position, which
will destroy things like
(let loop ()
...
(unless blah (loop)))
but the description says just that ("No expr is in tail position with
respect to the when form").
On Jul 5, Matthias Felleisen wrote:
>
> Like all Scheme conditionals, when/unless return the value of their
> sub-expressions if the condition is true. Otherwise, they produce
> false. The docs are wrong.
>
> Thanks for reporting the problem. For future discoveries of
> mistakes, please use Help Desk to report them. -- Matthias
>
>
>
> On Jul 5, 2008, at 4:19 PM, Yavuz Arkun wrote:
>
> > This is a rather minor issue I noticed in the documentation:
> >
> > According to http://docs.plt-scheme.org/reference/when_unless.html,
> > the results of evaluating WHEN and UNLESS are ignored. According to
> > http://docs.plt-scheme.org/reference/when_unless.html, the result is
> > #<void> (which is of course ignored by the REPL). Evaluating the
> > following expression in module language
> > shows that actually the result of the last expression in the body is
> > available at least in some cases; didn't test extensively.
> >
> >> (+ 1 (when #t (+ 1 2) (+ 3 4)))
> > 8
> >
> >> (+ 1 (unless #f (+ 1 2) (+ 3 4)))
> > 8
> >
> > So the question is...which version is the correct one? Ignored,
> > #<void>, value of the last expression in the body?
> > --Yavuz
> > _________________________________________________
> > For list-related administrative tasks:
> > http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!