
On Fri, 2007-09-14 at 21:55 +0200, Peter Verswyvelen wrote:
I'm not sure, I don't know LISP in detail, but as far as I know, LISP is a fully dynamic language.
I actually meant a static language where you build your own strong types using the language itself. On the micro level, the language only knows abouts bits and bytes without semantics, just like assembler, no types at all. But the language allows you to build whatever "type" or "semantics" you want from scratch, by providing a keyword that forces certain part of the program to be evaluated at compile time. A bit like macros, but written in the same language. Although not exactly the same, the Digital Mars D language has a "static if (p) { q }" statement, where p must evaluate to a constant expression at compile time, otherwise the compiler gives an error/warning (I'm not sure, haven't tried it yet). You can do that in C++ (using templates) and Haskell (using types) but these are actually mini-sub-languages. Probably giving control to the programmer of how type-checking should be coded bypasses the advantages of strong typing, so this is most likely a dumb idea...
You might find Forth interesting/entertaining. After implementing versions of Dijkstra's guarded if and do constructs using the same mechanisms that were used to implement the "native" control structures I decided that Forth was the closest thing to a genuine extensible language that I had ever worked with. -- Bill Wood