This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Unexpected error when missing a ? on a method name in it's definition


So I ran into another error when i was testing some of my code. If you
write a method but then test it with a ? on the end (when you meant to
define it with the ? but forgot, for example), you get the error
'Invalid parameter, was: gnu.expr.ModuleMethod cannot be cast to
gnu.bytecode.Type' (as shown below in the first two parts)

What I was expecting was something more like '/dev/stdin:3:1: unbound
location ...' (as shown in the third part below)

So I guess my question is, why do you get the two different error
messages and is this the expected behavior?

(I have a feeling it might have something to do with conversion of
names from Scheme-style to Java-style during the compilation to
bytecode, but I'm not sure. And shouldn't it still work correctly,
treating 'name' and 'name?' as two different things?

Thanks,
JP Verkamp

#|kawa:1|# (define test (lambda (x) (eq? x 'test)))

#|kawa:2|# (test? 'not-a-test)
Invalid parameter, was: gnu.expr.ModuleMethod cannot be cast to
gnu.bytecode.Type
java.lang.ClassCastException: gnu.expr.ModuleMethod cannot be cast to
gnu.bytecode.Type
	at atInteractiveLevel$2.run(stdin:2)
	at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:284)
	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:3|# (not-a-test? 'test)
/dev/stdin:3:1: warning - no declaration seen for not-a-test?
/dev/stdin:3:1: unbound location not-a-test?
	at gnu.mapping.Location.get(Location.java:67)
	at atInteractiveLevel$5.run(stdin:5)
	at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:284)
	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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]