bugKawa - Bugs: bug #44398, Unnecessary Warning when binding...

 
 

bug #44398: Unnecessary Warning when binding java object instances to a name

Submitter:  ruuns <ruuns>
Submitted:  Sun 01 Mar 2015 02:54:20 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  Documentation typo/error Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 05 Mar 2015 11:34:09 AM UTC, comment #2: 

I see :) Thx for the detailed clarification.

ruuns <ruuns>
Sun 01 Mar 2015 03:12:52 PM UTC, comment #1: 

The "no known slot" message means there is no slot known at compile-time, so the compiler has to generate code to do a run-time lookup (using reflection).  This succeeds, but is much slower.

The reason is due to the REPL: The compiler can't be sure that b is a point.  After all the next statement could be:

  (set! b "not-a-point")


Instead of 'define' you could use the new '!' operator, which is similar to define-constant (but will allow pattern-match).  You can also use 'define-constant', 'define-private', or plain define with a type-specifier:

  (define b ::point (point))


This is not a problem in a file (as long as it is processd in whole-file mode rather than line-at-a-time mode).

Per Bothner <bothner>
Group administrator
Sun 01 Mar 2015 02:54:20 PM UTC, original submission:  

Hi, this is an issue which is probably not very important but i would like to report it still for your knowledge.

I've tested some things in the REPL with some objects created with define-simple-class and found maybe an unnecessary warning.

Assume any define-simple-class definition e.g.

(define-simple-class point () (x init-value: 10))


You get no problem by using it with:

#|kawa:20|# (point):x
10
#|kawa:21|# (let ((a (point))) a:x)
10

But if you bind an instance to a name via define, you get an unexpected warning "no known slot" although the correct value is returned.

#|kawa:22|# (define b (point))
#|kawa:23|# b:x
/dev/stdin:23:1: warning - no known slot 'x' in java.lang.Object
10


Ruuns

ruuns <ruuns>

 

(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)
  • -email is unavailable- added by ruuns (Submitted the item)
  •  

    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
    2015-06-15 bothner Open/ClosedOpen Closed
    2015-03-01 bothner StatusNone Invalid

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code