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

Re: [Scheme-reports] [scheme-reports-wg1] Re: Proposed compromise on #68 "unspecified value(s)"

Per Bothner scripsit:

> Kawa defines set! etc to return #!void which is defined to be same as
> (values).

That's a nice design, which is also shared by STklos.  I tested my usual
crop of Schemes (which now includes KSi) thus:

(define x 0)
(list (set! x 10))
(call-with-values (lambda () (set! x 20)) list)

Most of them return the same things from the two expressions: a
list containing the specialized "undefined object".  Exceptionally,
Gauche and SigScheme return lists containing 10 and 20 respectively,
Larceny returns lists containing a pair of the variable name and its
value, and Ypsilon is inconsistent: it returns (10) the first time and
(#<unspecified>) the second.

This exercise flushed out two bugs in Kawa 1.11 (revision 6811M)::

1) Display suppresses printing #!void at all levels, not just the top
level, so typing (list #!void) to the REPL prints (), although calling
length on this result confirms that it contains one element.

2) Procedures which are Kawa types are not acceptable as either the
producer or consumer argument of call-with-values, so passing the R5RS
procedures list, vector, and string to call-with-values crashes with:

Invalid parameter, was: gnu.kawa.lispexpr.LangObjType cannot be cast to gnu.mapping.Procedure
java.lang.ClassCastException: gnu.kawa.lispexpr.LangObjType cannot be cast to gnu.mapping.Procedure
	at kawa.standard.call_with_values.apply(call_with_values.java:29)
	at gnu.mapping.CallContext.runUntilDone(CallContext.java:234)
	at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:348)
	at gnu.expr.ModuleExp.evalModule(ModuleExp.java:185)
	at kawa.Shell.run(Shell.java:281)
	at kawa.Shell.run(Shell.java:194)
	at kawa.Shell.run(Shell.java:175)
	at kawa.repl.main(repl.java:848)

> Kawa doesn't complain about (define x (set! y 32)) but it probably
> should.

A warning might be appropriate, but not an error, as x should be bound
to something (in this case #!void) in accordance with R5RS.

No saves, Antonio, loke es morirse en su lingua. Es komo            John Cowan
kedarse soliko en el silensyo kada dya ke Dyo da, komo          cowan@x
ser sikileoso sin saver porke.                      http://www.ccil.org/~cowan
                        --Marcel Cohen, 1985

Scheme-reports mailing list