Subject: Re: Static/Strong/Implicit Typing From: Erik Naggum <firstname.lastname@example.org> Date: 26 Jan 2004 08:11:48 +0000 Newsgroups: comp.lang.lisp Message-ID: <3284093508521329KL2065E@naggum.no> * sajiimori | If I were still running a Unix, I'd check out CMUCL -- as it is, I've | only seen CLISP and Corman, neither of which catch type errors at | compile time. :( Would CMUCL warn about this during compile-time? If | not, do you think it should? | | (defun x-plus-y (x y) | (+ x y)) | | (defun test () | (x-plus-y 5 "asdf")) I keep wondering why the static type crowd always make up this kind of examples. In the Common Lisp world, you are supposed to be conscious when you write your code, and the above fragment suggests that you are not, but want the compiler to wake you up from your code-writing coma. One reason to cater to the comatose programmers is that static typing with a wide variety of types adds a lot more things to think about. The other solution to this problem is dynamic typing. If you want to understand what is going on here, you have to begin by realizing that both static and dynamic typing are answers to another, logically preceding question. The static type crowd solved a problem when people passed around machine words with different meanings. «I know», said that static type genius, «I'll let the compiler keep track of all the types and refuse to run the program with values of random types confusing the machine!». In another office, far away, sat the dynamic typing genius and thought «I know, I'll make all values self- determine their types!». The latter genius laid the foundation for the reinvention of object-orientation with run-time type information, which needed to be added to the static type genius's world view at at heavy cost. If you write the above code in Common Lisp, the purpose of running it will be to investigate the response to type errors. You will observe that you invoke the debugger. One of the things you could do then is to realize that the function that was called should be a generic function, and you can back out of the call, redefine the function x-plus-y, and resume execution by retrying the call. Another thing you could do is to realize that you had made a mistake in the caller. In this case, you would back out of the call to test, instead, and redefine that function and resume execution by calling the new test function. Please think about how this is different from the static typing systems you appear to know better than Common Lisp. | So, as a variant of my original question: In a statically, implicitly | typed Lisp, do you think the features would still complement each | other well? As long as you do not understand what you already have, there is no point in answering your question about what would be. And /calm down/, please. Say to yourself that you are not «touchy», and that you have to /think/ when you feel uncomfortable, not lash out at whoever you think makes you feel uncomfortable. Can you do this? -- Erik Naggum | Oslo, Norway 2004-026 Act from reason, and failure makes you rethink and study harder. Act from faith, and failure makes you blame someone and push harder.