[r6rs-discuss] multiple values and mathematicians
derick.eddington at gmail.com
Fri Feb 20 13:00:03 EST 2009
On Fri, 2009-02-20 at 09:47 -0600, Alan Watson wrote:
> > 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.
I understood that for values records with call-with-values. I'm
focusing on a different type of continuation.
> Other implementations signal an error.
That's what I like -- being able to use systems that signal an error in
cases like (list (values)). I want to return (values) when I really
don't want something to return any value in case it accidentally gets
used somewhere that takes a value. I don't want the program to continue
with a value when it was supposed to get no value (because there was an
accident). Chez, Ikarus, and PLT error, and I want to continue using
systems that have that semantics.
> 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.
I've been concerned that what you're suggesting would mean the core
language requires always returning one value, and then we use values
records to contain zero or multiple values, and this would preclude the
semantics I like of being able to really return no value and get an
error if a value was expected.
> 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.
Why can't you currently forget about them? I don't think about them
until I think of a good use for them. Would you be OK with just moving
the bindings related to them to their own library?
> "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."  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.
Precluding the semantics I like seems like an artificial restriction to
me, especially since you can still always return one value if that's
what you like. But I'm not sure precluding what I like is implied by
what you're suggesting.
>  Is quoting Will's famous words a Scheme-local Godwin's Law?
Seems to be nearly a cult religion :) I agree with the sentiment and
objective, but people are always going to have different ideas of what
it means and how it applies for various things.
More information about the r6rs-discuss