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

Re: [Scheme-reports] Draft 3 Comments: Chapter 4



On Wed, 27 Jul 2011, John Cowan wrote:

> Denis Washington scripsit:
>
>> Thinking about it, leaving this unspecified makes sense as one couldn't
>> use "when" and "unless" to return a value from a procedure anyway
>> without risking an unspecified return value (if the test evaluates to #f
>> or #t, respectively).
>>
>> On the other hand, "begin" in an expression context also a sole
>> side-effect construct (otherwise, all expressions except the last in a
>> "begin" form would be useless) and still returns the last expression's
>> result. Given that "when" and "unless" are very similar, I find it to be
>> pretty intuitive if they have the same behavior. I'm undecided.
>
> The difference is that BEGIN can have a value if its last argument does, but
> you can't ever rely on WHEN or UNTIL having a value, so you can only
> use it for effect portably.  That being so, it might as well return
> an unspecified value in all cases.

This is news to me. The semantics I expect from WHEN and UNTIL are that  they
return the value of the last expression in their bodies. I am aware of no
reason  to not do this.

 	Aaron W. Hsu

-- 
Programming is just another word for the lost art of thinking.

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports