Hard choices, r6rs, harder to write code

Posted on Mon Dec 5, 2016

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:

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).