bugKawa - Bugs: bug #40710, Class aliases and array definition

 
 

bug #40710: Class aliases and array definition

Submitted by:  Matthieu Vachon <maoueh>
Submitted on:  Tue 26 Nov 2013 03:24:04 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Invalid
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.

 

Tue 26 Nov 2013 05:32:22 PM UTC, comment #2:

Ah nice, I'm so used to old Kawa notations that I was sure it was the right way to declare it :)

Thank you for your answer.

Matthieu Vachon <maoueh>
Tue 26 Nov 2013 05:12:03 PM UTC, comment #1:

Ah, but it does work, if you use the right syntax:

#|kawa:1|# (define-alias <MyString> <java.lang.String>)
#|kawa:2|# (make <MyString>[] size: 1)
[#!null]

Don't think of the syntax <Foo> as the syntax for a class or type-specifier. It's just an ordinary name, as is <Foo[]>. It's just that <Foo> and <Foo[]> have a default binding to the class or array type if class Foo exists (at compile-time). But in newer versions of Kawa, so does the syntax without angle-brackets:

#|kawa:4|# (define-alias MyString java.lang.String)
#|kawa:5|# (make MyString[] size: 1)
[#!null]
#|kawa:6|# (make java.lang.String[] size: 1)
[#!null]

You can also mix the forms:

#|kawa:8|# (define-alias MyString <java.lang.String>)
#|kawa:9|# (make MyString[] size: 1)
[#!null]

There is a slight difference between <ClassName> and plain ClassName, but it is pretty subtle, mainly in noting intent.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Tue 26 Nov 2013 03:24:04 PM UTC, original submission:

It would be cool if aliases could be resolved to aliased class when creating arrays.

For example, the following will fail in the REPL:

This will generate the following output in the REPL:

There will be a similar error when compiling the code. For now, the simple workaround is to use the non-aliased class name.

Matthieu Vachon <maoueh>

 

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

    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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 26 Nov 2013 06:04:09 PM UTCbothnerOpen/ClosedOpen=>Closed
    Tue 26 Nov 2013 05:12:03 PM UTCbothnerStatusNone=>Invalid
      Assigned toNone=>bothner

    Back to the top


    Powered by Savane 3.1-cleanup1