From: Per Bothner <per@bothner.com>
To: Damien MATTEI <Damien.Mattei@unice.fr>,
Kawa mailing list <kawa@sourceware.org>
Subject: Re: display object class type
Date: Fri, 13 Jan 2017 17:36:00 -0000 [thread overview]
Message-ID: <ffdec3eb-43f9-cbe0-fa54-5342a065a61b@bothner.com> (raw)
In-Reply-To: <201701131559.29117.Damien.Mattei@unice.fr>
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/
prev parent reply other threads:[~2017-01-13 17:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-13 14:59 Damien MATTEI
2017-01-13 17:36 ` Per Bothner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ffdec3eb-43f9-cbe0-fa54-5342a065a61b@bothner.com \
--to=per@bothner.com \
--cc=Damien.Mattei@unice.fr \
--cc=kawa@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).