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

 
 

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

Submitter:  None
Submitted:  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
* Mandatory Fields

Add a New Comment Rich Markup
   

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)
12.0

Per Bothner <bothner>
Group 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.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    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.13-4448.
    Corresponding source code