Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Stalin warnings...
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 6th April 05:33
External User
 
Posts: 1
Default Stalin warnings...



As I said often enough in this group, Stalin is very friendly in the
sense that it issues error messages or warnings at compile time, not
when it is running in the machine of the teaching assistant who is
reviewing your assignments. Its static analysis is really a great
productivity tool. However, Stalin sometimes exaggerates in issuing
warnings. For instance, what can go wrong with the following code?

(display `(,(* 4 10) 30))

Stalin issues a quite long list of cryptic warnings when fed with the
above line! Another example:

(display (read))

The list of warnings is even longer. Is there a way to compile
programs like these, without warnings? Of course, I want the compiler
to generate safe code; therefore I do not want to compile with the -Ot
option:

stalin -On -Ot teste.sc

This suppresses the warnings, but it also suppresses dynamic type
checking, if I understood the manual. In any case, I think that the
compiler should accept programs like the ones given as examples
without reporting an error, or issuing a warning. It would be even
better if it had a safe way to read primitive types, like integers. It
should detect that a piece of code like this:

(let ((x (read))
(when (integer? x) (display (+ x 2))))

has no way to go astray. A solution like ML/Clean/Haskell Maybe-
exceptions would be great. A soft solution would be fine too. By soft
solution, I mean that the compiler --- that seems to be so smart ---
could try to discover when a piece of code is bullet proof; if it
fails, it could issue a warning, like Clean does. However, It should
be able to discover that

(let ((x (read)))
(when (integer? x) (display (+ x 2))))

is bullet proof; at least I think it is. Perhaps the problem is
undecidable, but what is the function of Artificial Intelligence other
than solving undecidable problems? smile :-)
  Reply With Quote


 


Reply


Thread Tools
Display Modes




666