Re: Precise types & retyping

Daniel Bonniot <[email protected]>
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
>If I have two packages:
>
>Package A:
>
>    import org.eclpise.swt.* (!);
> 
>Package B:
>    
>    import org.eclipse.swt.*;
>
>Now, everything in org.eclipse.swt has two types? That doesn't make sense. 
>
No. That means that in package A you choose a certain policy, in B a 
different one.

I agree that normally there should be an "ideal" retyping for a given 
Java library. It's not always obvious, though, because many methods do 
not specify if they accept null arguments, under what circumstances, if 
any, they can return null, ...

>I
>suggest that you move this package-level retyping to the package declaration:
>
>org/eclise/swt/typing.nice:
>package org.eclise.swt (!);
>// retypings/renamings of specific methods/constructors/etc follow
>  
>
There is no package declaration for swt. It lies in a jar on your 
classpath, that's all.

>I think it only makes sense to keep retypings in a centralized place. In fact,
>you could pull retypings out of the grammar for Nice files and require that
>retypings be in seperate *.typing files that only allow retypings. 
>
Yes, but that would need a specfication of .typing files. The import 
statement seems like a logical place to specify how that package is 
retyped by default.

I'm all for centralizing retypings for commonly used libraries, so that 
this work can be shared. That's one of the things NiceSwing does, and 
that NiceSWT will. Still, there are some less popular library that can 
be useful to only a few users, so it's useful to have a convenient way 
to use them.

>I don't think
>that retyping declarations should be part of the language definition, since it
>doesn't make sense to retype a Nice method; it only makes sense to retype a
>non-Nice method.
>  
>
Agreed. It's not part of the language definition. It happens to be 
supported by a particular implementation that integrates with the Java 
platform.

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.