Re: Precise types & retyping
Daniel Bonniot <[email protected]>
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
>Not sure how you would abstract the ole win32 support ;-) > > Right. It's not needed to care for that part, at least in a first phase, is it? I just commited to CVS an implementation of package level "retyping policy". You add the policy part just after you import a java package. The syntax is: import org.eclipse.swt.* (!); The (...) represent method arguments, and ! non-null types, both being consistent with Nice's syntax. So this says that for package org.eclipse.swt, method arguments are by default taken to be non-null. Results are also non-null as usual. Note that this does not specify the policy for "subpackages" (* stands for "any class"). Tell me if this helps reduce the number of retypings. If other policies are useful, I could add them (e.g. non-null args but possibly-null results). It would be also possible to set policies per class (overriding the package policy if present). That would be useful if some classes (with a significant number of methods) have a consistent pattern that differs from the package's majority. I guess in that case it would be useful to declare a list of classes, instead of only one. Something like: import org.eclipse.swt.* (!); import class org.eclipse.swt Window, Button, WhatEver (?); That could also serve the role of import class.org.eclipse.Window; in Java, which we are currently missing in Nice. 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