I was reading Paul Graham's "The Hundred-Year Language" article.
http://www.paulgraham.com/hundred.html
In there he makes a claim that static typing "preclude[s] true macros".
For example, types seem to be an inexhaustible source of research papers, despite the fact that static typing seems to preclude true macros-- without which, in my opinion, no language is worth using.
How is this true? Where are the papers? I tried searching on Google without success.
In the static typing camp we have the benefits of catching bugs earlier in the development cycle, eliminating altogether some classes of bugs in deployed systems, improved things like code-assist and other tool support, and enabling compiler optimisations.
Static typing has the following main benefits: It allows statically (without running the program) detecting many programming errors quickly, reliably and automatically. This helps reduce the number of bugs and reduces the time spent on debugging. Type declarations serve as automatically-checked documentation.
A statically-typed language is a language (such as Java, C, or C++) where variable types are known at compile time. In most of these languages, types must be expressly indicated by the programmer; in other cases (such as OCaml), type inference allows the programmer to not indicate their variable types.
Paul Graham is a proponent of having "the whole language there all the time":
There is no real distinction between read-time, compile-time, and runtime. You can compile or run code while reading, read or run code while compiling, and read or compile code at runtime.
Running code at read-time lets users reprogram Lisp's syntax; running code at compile-time is the basis of macros; compiling at runtime is the basis of Lisp's use as an extension language in programs like Emacs; and reading at runtime enables programs to communicate using s-expressions, an idea recently reinvented as XML.
So he may be referring to the practical impossibility of defining new types at runtime in a language that expects to have all the type information at compile time, as Daniel Ribeiro points out on his blog:
Note that you cannot make type-safe runtime metaprogramming in general. For instance: even though some languages allow you to create interfaces that do not exist on compile time, the only way to invoke methods from these is through non type-safe ways (such as reflection).
I am sure that you would have no trouble finding programmers who dispute that this capability is worth giving up the benefits that they derive from static typing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With