Can you name languages with static type checking (like Java) and where code is data (like in LISP)? I mean both things in one language.
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.
Type checking is the activity of providing that the operands of an operator are of compatible types. A compatible type is one that is legal for the operator or is enabled under language rules to be implicitly modified by compiler-generated code to a legal type. This automatic conversion is known as coercion.
In Static Typing, type checking is performed during compile time. It means that the type of a variable is known at compile time. For some languages, the programmer must specify what type each variable is (e.g C, C++, Java), other languages offer some form of type inference(e.g. Scala, Haskell).
Qi is a statically-typed Lisp dialect. Also, many other Lisp dialects have (optional) static typing.
Java itself has very limited capabilities of this kind.
The interesting question is not so much whether you can have metaprogramming and static typing, it's whether you can have dynamic metaprogramming be statically type-safe.
There is Template Haskell which does metaprogramming and is type-safe, but it is static metaprogramming.
At the moment I can not think of any language that I know for a fact allows dynamic metaprogramming and where dynamic metaprogramming is statically type-safe. Qi might be bale to do it, but I'm not sure.
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