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]

Re: query type of an instance


Luis Casillas wrote:
You can just call the class() method on objects. Somewhere near the top of your source file:

(define-namespace Object <java.lang.Object>)

... and then, when you want the class of foo:

(Object:class foo)


How to make it in REPL?


#|kawa:6|# (define x (cons 1 2))
#|kawa:7|# (define-namespace Obj <java.lang.Object>)
#|kawa:8|# (Obj:class x)
/dev/stdin:8:1: warning - no possibly applicable method '<init>/valueOf' in java.lang.Object
gnu.mapping.WrongArguments: call to 'java.lang.Object.<init>()' has too many arguments (2; must be 1)
at gnu.mapping.MethodProc.matchFailAsException(MethodProc.java:96)
at gnu.kawa.reflect.Invoke.applyN(Invoke.java:234)
at gnu.kawa.reflect.Invoke.apply(Invoke.java:99)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:313)
at kawa.Shell.run(Shell.java:275)
at kawa.Shell.run(Shell.java:186)
at kawa.Shell.run(Shell.java:167)
at kawa.repl.main(repl.java:870)


--
WBR, Yaroslav Kavenchuk.


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