TUNES digest, Vol 1 #356 - 8 msgs
Pascal Bourguignon
pjb@informatimago.com
Fri May 30 11:17:02 2003
Alaric B Snell wrote:
> Now, I see a lot of fighting between the strict typing people and the
> non-strict typing people; it's part of a large battle between "rigorous
> careful engineering" and "throw it together". This battle has come up in
> debates about schema languages on xml-dev, and in things like the
> Extreme Programming movement.
When talking about typing, please keep in mind this:
[pascal@thalassa pascal]$ clisp
;; Loading file /home/pascal/.clisprc.lisp ...
;; Loaded file /home/pascal/.clisprc.lisp
[1]> (+ "toto" 2)
*** - argument to + should be a number: "toto"
1. Break [2]> (quit)
[pascal@thalassa tests]$ cat c-faiblement-type.c
#include <stdio.h>
int main()
{
printf("\"toto\"+2=%d\n","toto"+2);
return(0);
}
/*** c-faiblement-type.c -- 2003-05-29 18:46:36 -- pascal ***/
[pascal@thalassa tests]$ cc -o c-faiblement-type c-faiblement-type.c ; ./c-faiblement-type
"toto"+2=134513910
With respect to compilation/interpretation, I would say that this is
only a efficiency optimization that should not concern us
programmers/system builders. That is, if you need to have automatic
type checking (and yes we need it!), it has not to be linked with a
compilation step. Linking any such kind of analysis/checking of the
program/system to a compilation step is too limiting, and miss
possibly a lot of errors. Of the kind of the bug which caused the
Mars Climate Orbiter crash.
Jeff Cutsinger wrote:
> A lot of the literature on software engineering incorrectly assumes
> total knowledge is available to begin with, so the designer produces a
> single monolithic system that precisely meets those needs...
That would be an argument for dynamic type checking. If the programmer
can't have a total knowledge of the system he's building, how can you
expect his tools to have it? Even in a pure open source environment.
James Michael DuPont wrote:
> The entire thing that makes perl great is that you can write baby perl,
> simple online statements like in sed or grep that do things that are
> useful. That is the macro system to the extreme.....
That's not a language feature, but a tool feature:
[pascal@thalassa pascal]$ clisp -q -norc -x "(prog1 (values) (with-open-file (in \"/dev/stdin\" :direction :input) (loop with lines = nil for line = (read-line in nil :eof) until (eq line :eof) do (push line lines) finally (dolist (line lines) (format t \"~A~%\" line)))))"<~/tmp/misc/wang |head -8
32 -that's all-
31
30
29
28
27 publie en 1962 par MIT Press, un des maitres-livres de l'Informatique.
26 1960), et il a ete repris dans le celebre 'LISP 1.5 Programmer's Manual'
25 de LISP (LISP 1, sur IBM 704 justement, le manuel est date de Mars
What's more, it's trivial to add this feature to any language:
[pascal@thalassa pascal]$ ~/tmp/tests/c-script 'int i=0;while(i<5){printf("%03d\n",i);i++;}'
000
001
002
003
004
[pascal@thalassa pascal]$ cat ~/tmp/tests/c-script
#!/bin/bash
cat >/tmp/$$.c<<'EOF'
#include <stdio.h>
int main(int argc,char** argv)
{
EOF
echo $@ >> /tmp/$$.c
cat >>/tmp/$$.c<<'EOF'
return(0);
}
EOF
cc -o /tmp/$$.exe /tmp/$$.c && /tmp/$$.exe
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
Do not adjust your mind, there is a fault in reality.