I have made some important changes on the master
branch of Vicare. These
changes will make some fully compatible r6rs code not to compile anymore or raise
run–time errors. Life is hard. It goes like this:
So, r6rs informs us that some expressions, under some conditions, return
unspecified values. This is bad. In many such situations: Vicare caused the
expressions to return the single value ‘#<void>’, which is bad for obvious
reasons. I have made changes so that in such situations the expressions should
return zero values; we can return zero values with (values)
. This has hard
consequences especially with conditional expressions.
Here is what happens:
when
: the expression always returns
zero values.
unless
: the expression always returns
zero values.
if
: the expression always
returns zero values.
if
: the arms must return
the same number of values; it does not matter which types the returned values have,
but the number of values must be the same.
cond
without else
clause: the
expression always returns zero values.
cond
with else
clause: the
branches must return the same number of values; it does not matter which types the
returned values have, but the number of values must be the same.
case
without else
clause: the
expression always returns zero values.
case
with else
clause: the
branches must return the same number of values; it does not matter which types the
returned values have, but the number of values must be the same.
Notice that raising an exception in a clause will match any number of values from other clauses, so the following will compile correctly:
(if (test-expr) (values 2 3) (error #f "error"))
Clearly these changes make writing code harder. We have to care about the return
values. We have to care about the else
clause. Using the typed language
helps in finding and fixing a mismatch in returned values; when using the standard
language we are left on our own with “your problem” run–time error messages.
To mark this step: I have bumped the version number from “development 0”
(0.4d0
) to “development 1” (0.4d1
).