This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: swing.scm
On 02/19/2011 06:43 PM, Jamison Hope wrote:
On Feb 19, 2011, at 6:46 PM, Per Bothner wrote:
If #!void is the same as (values), then #!void can't be a single value.
Except that it is, in Kawa, in a context expecting a single value.
Racket throws an error:
(length (list (values)))
context expected 1 value, received 0 values
but Kawa accepts #!void or (values) as a single value:
#|kawa:1|# (length (list #!void))
1
#|kawa:2|# (length (list (values)))
1
Yes - but I think this is inconsistent - i.e. a bug.
We need to work out consistent and useful behavior
for "multiple values" and "void".
Part of the inconsistencies is for the sake of optimizability.
I'm working on improving data-flow analysis and type inference,
which might permit some more consistent powerful yet efficient
semantics.
But first I need to finish the new data-flow analysis framework
(basically SSA - http://en.wikipedia.org/wiki/Static_single_assignment_form)
I'm in the middle of, before I get back to thinking about
sequences and multiple values.
I really don't like the idea of silently ignoring values
that don't have the correct type.
I suppose it's a matter of opinion to say that only JMenuItem is the
"correct type". ;-) Anyway, right now it silently fails with a class
cast exception on the EDT, which hardly seems better.
A class-cast exception is sometimes the right behavior, in terms of what
the *language semantics* should be. In Javafx Script we tried to define
the semantics to suppress/ignore exceptions (e.g. index-of-bounds being
silently ignored) - I was never comfortable with that approach.
--
--Per Bothner
per@bothner.com http://per.bothner.com/