Re: Precise types & retyping

Daniel Bonniot <[email protected]>
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
Isaac Gouy wrote:

>One of the benefits of Nice is that we can reuse existing Java
>libraries. The tedious aspects of this are null testing or writing
>retypings.
>  
>
The current policy (in the absence of retyping) is to choose the most 
convenient nullness for Java types (that is, parameters can be null, but 
results are guarenteed not to be null). This means that the compiler 
should not bother you, so that should not be tedious. Of course, you 
don't get the extra safety you get when using Nice libraries, but there 
is no simple automatic way to do so. You can get the safety back by 
writing the retypings.

There is a plan to allow code to set a different retyping policy for a 
whole class or a whole package. That should help limit the number of 
necessary retypings by picking the right policy, and then enumerating 
the few special cases.

>Is there a way to deal with multiple Java class constructors in a
>retyping?
>  
>
You mean retype several constructors in one go? There will be the way 
mentioned above. What else can you imagine?

>Which methods/fields/classes/interfaces... actually need retyping?
>  
>
None, until you find a reason to add a retyping ;-)
Seriously, you should not need to write retypings in most cases, so wait 
to find a need for them. One main reason is a type that should be 
parameterized, like List, since Nice can not guess what kind of List it 
is, so you have to tell it.

>Would it be possible to use reflection to automatically write Nice
>retypings for a Java library?
>  
>
How would it guess the type information that is not there (nullness, 
parameterized types)?

Daniel



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.