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

Re: [Scheme-reports] "unspecified values"

On 05/21/11 19:17, Alex Shinn wrote:
> It's not a matter whether the code they wrote
> generalizes to a wider class of uses or not.
> It matters that the code works the way they
> were using it before, and with the proposed
> change the code would break.

Yep; and it's then their problem to fix it (and nobody else's) for
having done something that makes assumptions in the first place.

As I said in *my* identikit reply, I often write:

(define (debug label value)
    (printf "DEBUG: ~s=~s\n" label value)

...and if I then mistakenly use it in code that uses MV, I then get
around to making it all call-with-valuesy! But if I were writing it as a
library for general publication and consumption, I'd do it properly the
first time round.

Perhaps what should happen, to encourage people to Do It Right The First
Time, is to have some syntax to capture the values of an expression as
some opaque object, and another to return those values.

(values-of (values 1 2)) => unspecified

(let ((x (values-of (values 1 2))))
     (unwrap-values x)) => 1 2

My debug procedure would need to become syntax to properly wrap the
value expression, so perhaps it's not enough, though...


Alaric Snell-Pym

Scheme-reports mailing list