by
Robert Barr >> Tue, 15 Feb 2000 4:42:44 GMT
Umm.. Not come across too many occasions where warnings might have been useful (unless the compiler writers somehow build in stuff for detecting that the programmer is trying to do something completely insane!)
I think compiler warnings in JADE are mostly irrelevant. A
'higher-level' language protects the developer from the flexibility of c/c++, e.g. common pointer abuse like *(p+1) and other direct memory access problems don't apply. Neither do linker and other predeclaration type warnings. I haven't looked at a compiler warning list, so there may be some other specifics that would be useful. However, for the case of object comparison, (when casting from a superclass to a subclass?), I'd be pretty peeved if I couldn't permanently disable this warning.
Slightly related issue: what could also be useful would be the ability to define some kind of conditional compilation like you have in C. I'm particularly thinking of things like method preconditions, postconditions and class invariant mechanisms (a la Meyer) which you want to have enabled for development but not necessarily for production systems where such checks can impact performance (and any bugs trapped by the checks should have been caught during development). This is probably a bit of a bigger topic than compilation warnings though...
You have my vote on this one - this would improve the robustness of
reuse class implementations, and reduce the amount of condition checking code in routines.
I wonder if pre/post condition and invariant assertion failures be implemented as exceptions, and if so, what specific behaviour would be required?
<waffle>
This brings to mind another posting (in jade_tech_design_architecture)
on parameter overrides on the create method. A desire was expressed to enforce in the class definition (rather than relying upon a convention
of method call sequence) that the name property of the class Person was not null. Perhaps a mechanism using class invariant and an 'initialised' flag would acheive this? e.g.
class Person
invariant
(name <> null) or (not initialised)
The initialise method sets the flag. Every exported method (except
create and initialise) has the precondition:
method myMethod
require
initialised = true;begin
.....
end;
This appears at first sight to be at odds with Meyer's statement that "Create may be seen as the operation that ensures that all instances of
a class start their life in a correct mode". However the above implementation only serves to force the call sequence convention (as create and initialise are inseparable), so the intent of the statement is not violated.
(This example is not intended as an argument for providing such assertions in JADE - I'm sure there are far better cases!)
</waffle>