[r6rs-discuss] multiple values and mathematicians
Alan Watson
alan at alan-watson.org
Fri Feb 20 10:53:03 EST 2009
> Zero return values and implicitly dropping extra values are not
> reasonably possible with library-provided "values records" returned
> as a
> "normal / core" single value, are they?
There is no problem with zero return values. In my sketched
implementation, (values) would yield a "values record" containing no
values. The call-with-values procedure would unwrap this and call the
consumer procedure with no arguments.
Implicitly dropping extra values in cases when the continuation
expects exactly one value is not portable. It is "unspecified" in the
R5RS and "undefined" in the R6RS. Some implementation silently coerce
excess values to a single value and missing values to unspecified
values. Other implementations signal an error. My sketched
implementation would do something different again. Another
implementation might turn your computer into a whale and a bowl of
petunias. All of these behaviours are permitted by the R5RS and R6RS.
> If you don't like any number of return values, can't you ignore it and
> always use one return value without problems?
If I don't like the hundreds of pages of funky 1970s functions and
macros in CLtL, can't I just ignore them and use the bits I like? :-)
Multiple values are currently part of the language. I think they
should be part of the library. That way I can forget about them except
if and when I need them.
"Programming languages should be designed not by piling feature on top
of feature, but by removing the weaknesses and restrictions that make
additional features appear necessary." [1] A weakness that made
multiple values appear necessary was the lack of record types. It has
now been removed. So, I now advocate removing the unnecessary
additional features or, rather, moving them to the library.
Regards,
Alan
[1] Is quoting Will's famous words a Scheme-local Godwin's Law?
--
Alan Watson
http://www.alan-watson.org/
More information about the r6rs-discuss
mailing list