Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you know of a language with Static Type checking where Code is Data? [closed]

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.

like image 438
Dzmitry Lahoda Avatar asked Jun 18 '10 14:06

Dzmitry Lahoda


People also ask

What is static typed 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.

What is type checking in programming language?

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.

What is a static type checker?

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).


1 Answers

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.

like image 116
Jörg W Mittag Avatar answered Sep 24 '22 05:09

Jörg W Mittag