bugKawa - Bugs: bug #37456, colon notation and calling a...


bug #37456: colon notation and calling a static method though an instance

Submitted by:  None
Submitted on:  Fri 28 Sep 2012 02:50:37 PM UTC  
Category:  None Severity:  3 - Normal
Item Group:  Feature Request Status:  Wont Fix
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 08 Apr 2016 05:31:06 PM UTC, comment #1:

I see no need for colon notation to support thi.
It would add inconsistancy and ambiguity to a syntax that is already heavily overloaded.

There are alternate syntaxes you can use. For example the invoke pseudo-function allows calling a static method on an instance:

#|kawa:1|# (define d ::java.lang.Double (java.lang.Double 3.1))
#|kawa:2|# (invoke d 'valueOf 12)

Per Bothner <bothner>
Project Administrator
Fri 28 Sep 2012 02:50:37 PM UTC, original submission:

Generally speaking, (instance:method-name argument ...) gives the
same result as (*:method-name instance argument ...), but
it is not necessarily true.

One of the exceptional cases is the case where the instance is
an instance of java.lang.Class, as described in the Kawa document.

I have found another exceptional case. Given a Java Class Foo:

public class Foo {
public Foo() {}
public static Object foo(Object obj) {
return obj;

(define bar (Foo))(bar:foo "abc") causes error:

gnu.mapping.WrongArguments: call to 'Foo.foo(java.lang.Object)' has too
many arguments (2; must be 1)

while (*:foo bar "abc") makes a good result.

I don't think calling a static method though an instance is not a
good practice, but it is sometimes used. Automatically rewriting
(*:x y ...) into (y:x ...) is dangerous.

I would like Kawa to support colon notation for calling a static method though an instance.



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-01-16 bothner Open/ClosedOpen => Closed
    2016-04-08 bothner StatusNone => Wont Fix

    Back to the top

    Powered by Savane 3.3