# What are the characteristics of a typeless programming language?

Assume that we have an imaginary programming language that allows you to assign a Literal to a variable, but does not allow you to set the the data type of the variable, for example

Allocate4Bytes   an_int_variable        123456;
Allocate2Bytes   a_short_int_variable   123;
Allocate4Bytes   a_float_variable       2.1;


And this programming language also provides different operators to work with different data types, for example:

• The + operator is used to add an int to a short int.
• The #+ operator is used to add a float to an int.
• the = operator is used to assign an int to an int.
• the #= operator is used to assign a short int to a short int.
• etc.

So it is the job of the programmer to keep track of the data type of each variable and use the appropriate operator on it.

Is this programming language considered to be a typeless programming language, or can we say that this programming language have data types (even though it does not have operator overloading and type safety, etc.)?

• It's simple: the variables have no type. An example of a typed language is C/C++ (you have a char, an int, a float,...), while not typed languages don't have it (e.g., Mathematica). Apr 26, 2019 at 22:07
• Your language, on the other hand, looks like to be typed (even if not explicitly defined). However, I'm not an expert on this subject and I'm not 100% sure about it... Please, someone correct me if I'm wrong. Apr 26, 2019 at 22:12
• @Iago Carvalho You said that a typeless language means that "the variables have no type", and then you said "Your language, on the other hand, looks like to be typed". How is my language looks like to be typed if my variables don't have data types? Apr 26, 2019 at 23:12
• @IagoCarvalho Your first comment suggests you have some common confusions about typing. It has nothing to do with variables. Every expression in a statically typed language has a type, and it's values not variables that are tagged in a dynamically typed language. It's also not necessary that you can declare variables as having some type. It's possible to have a statically typed language that doesn't require or even allow type declarations (e.g. Hindley-Milner). It's possible to have a statically typed language that doesn't even have variables, e.g. a typed concatenative language. Apr 27, 2019 at 19:59

It depends on what happens if the programmer tries to do something like add two things with the wrong operator. If it causes a compile-time error, the language is probably statically typed. If it throws a runtime error complaining that the two have the wrong type, the language is probably dynamically typed. If it doesn't throw an error and just tries to add those two things (possibly resulting in gibberish), it might be untyped.

To put it another way, it depends how those operations are implemented. If they are implemented to keep track of the type of the variables and check that those types match what is expected, it is typed. If it doesn't keep track of types, then it is untyped or weakly typed.

• @D.W.♦ "If it doesn't throw an error and just tries to add those two things (possibly resulting in gibberish), it might be untyped." So can we say that a typeless language is a language that does not have type safety? Apr 27, 2019 at 15:31
• @user4582812, well, you're the one who used the word "typeless", so I'd hope you could tell me what you mean by that. Phrases like "type system", "strongly typed", "weakly typed", "static type checking", "dynamic type checking", etc. have more or less standard meanings, but I'm not aware of any standard meaning for the word "typeless".
– D.W.
Apr 27, 2019 at 16:40
• @D.W.♦ I think that "typeless" and "untyped" refer to the same thing (for example, I have seen the B programming language being called a typeless language in some tutorials, while in other tutorials it has been called an untyped language). But I also seen tutorials referring to dynamically typed languages like JavaScript as an untyped language (so maybe "untyped" have dual meaning). Apr 27, 2019 at 17:02
• @D.W. I would not describe most of those phrases as having standard meanings. At best, there might be some technical definitions that would be reasonably acceptable to programming language theorists, but which many - probably most - programmers are not aware of. In the general programming community the terms are used vaguely and inconsistently. For example, often "strongly typed" is used as a synonym for "statically typed", but it is also used for different meanings of "type safety" which is also used inconsistently. Apr 27, 2019 at 23:02
• As an example, have you actually read that Wikipedia page? It is pretty bad and illustrates these inconsistencies and vagaries. I do agree that those terms are more commonly used than "typeless". Apr 27, 2019 at 23:02

A typeless computer language is one that imposes no type-like rules on values. A value may be treated as an integer, float, string, pointer etc by simply using it as if it were, usually by passing it as an argument to an operator.

BCPL was typeless in that it had a machine word of a predetermined size as its only data type, and that word could be used as an integer, pointer, character etc at will. It made writing compilers easier, and using them harder!

Parts of this philosophy made their way into its successor B, and thence into the C language that finally succeeded it. You can still write typeless code in C, if you don't mind adding a few casts and ignoring a few warnings.