bugKawa - Bugs: bug #42722, Explicit type declaration, later...

 
 

bug #42722: Explicit type declaration, later instance? check issues

Submitted by:  None
Submitted on:  Thu 10 Jul 2014 04:30:44 AM UTC  
 
Category: Type declaration and inferenceSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 31 Jul 2014 02:51:55 PM UTC, comment #2:

I checked in a fix for this.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu 10 Jul 2014 05:39:00 PM UTC, comment #1:

This is a gray area: The type 'String' is a special type in that every value is compatible with it: a non-null value x is converted to the String type by calling x.toString().

Instead, you might want to use:
(instance? v1 string) ;; lower-case string type
or:
(instance? v1 java.lang.CharSequence)
or:
(instance? v1 java.lang.String)

The type string is equivalent to java.lang.CharSequence.

Back to the String type: even if every value is convertible to String, it is probably not correct to say (instance? v1 String). As you've noticed there some inconsistencies in this result, if v1 is a more complex expression. There does seem to be a bug.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu 10 Jul 2014 04:30:44 AM UTC, original submission:

I am using Kawa Scheme 1.14 downloaded as JAR from the ftp server.
Try the following:

(define v1 ::int 0)
(instance? v1 String)

This returns #t, whereas I expected #f. Maybe I am understanding the language semantics wrong?

(define v2 (+ v1 2))
(instance? v2 String)

This returns #f as expected.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 31 Jul 2014 02:51:55 PM UTCbothnerStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Thu 10 Jul 2014 05:39:00 PM UTCbothnerStatusNone=>Confirmed
      Assigned toNone=>bothner

    Back to the top


    Powered by Savane 3.1-cleanup1