* display object class type
@ 2017-01-13 14:59 Damien MATTEI
2017-01-13 17:36 ` Per Bothner
0 siblings, 1 reply; 2+ messages in thread
From: Damien MATTEI @ 2017-01-13 14:59 UTC (permalink / raw)
To: Kawa mailing list
Hi,
for debugging purpose i wanted to display the type of an object in kawa,
i compile this:
(display (type1:getClass:getName) )
ok for compiling but when running i got a Null pointer:
#!null
???
strange ,is there a way to make it work?
my object is not Null it display as B5 , a string (java.langString or FString or gnu.text.char .... i do not know but not Null
Damien
--
Damien.Mattei@unice.fr, Damien.Mattei@oca.eu, UNS / OCA / CNRS
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: display object class type
2017-01-13 14:59 display object class type Damien MATTEI
@ 2017-01-13 17:36 ` Per Bothner
0 siblings, 0 replies; 2+ messages in thread
From: Per Bothner @ 2017-01-13 17:36 UTC (permalink / raw)
To: Damien MATTEI, Kawa mailing list
On 01/13/2017 06:59 AM, Damien MATTEI wrote:
> (display (type1:getClass:getName) )
>
> ok for compiling but when running i got a Null pointer:
>
> #!null
>
> ???
>
> strange ,is there a way to make it work?
>
> my object is not Null it display as B5 , a string (java.langString or FString or gnu.text.char .... i do not know but not Null
It's confusing, but it's because colon notation tries to do so much ...
There are two problems:
(1) You can write either
(type1:getClass) ; call getClass method of type1
or:
type1:class ; get class property of type1
Either works, because an X property can resolve either to an X field
or a getX method.
However, if you leave out the (inner) parens:
type1:getClass
you get a procedure that *if* you apply it calls the getClass method.
(2) There is an unfortunate ambiguity between:
(object:method-name arg ...) ; instance method invocation
(Class:method-name arg ...) ; static method invocation
type1:class (or (type1:getName)) returns a class, so for
(type1:class:getName)
looks for the static method getName in the class of type1.
Summary: you should write:
(invoke type1:class 'getName)
Seehttps://www.gnu.org/software/kawa/Method-operations.html
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-13 17:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 14:59 display object class type Damien MATTEI
2017-01-13 17:36 ` Per Bothner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).