Hello.
I have assert/trace methods in Kiev compiler, and work-by-contract
will be ready in about a few days (I mean - pre/post conditions
and invariants).
But the usage of conditions is meaningful, without library
support. For example, if I wish eliminate all possible
NullPointerException, I need
Object foo(...)
ensure { $return != null }
{
...
}
for all library functions that should not return null - then
NullPointerException may be checked at compile time...
Ok, NullPointerException, ClassCastException and ArrayIndexOutOfBounds -
are the most "used" RuntimeException-s, that prevents running
about 50% of downloaded application/applets (in my own expirience)...
I wish to make possible compile-time detection of those
RuntimeException-s,
but I need a core library with pre/post conditions and invariants for
this task. Is it possible to make $classpath library in this way?
PS Ah, a note about backaward compatibility with javac - you
may enclose any extended code in "magic" comments -
Object foo(...)
/*{ ensure { $return != null } }*/
{
...
}
Where /*{ ... }*/ are used as normal source by Kiev compiler, and
are comments in java.
If you will need any other syntax constructions for compatibility with
javac - I will add them ;-)
--
Maxim Kizub, Forestro
mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
Visit Kiev language homepage http://forestro.com/kiev/