(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 :-)