Is there a term to refer to languages where variables are not preassigned a type?

86 views Asked by At

For example JS, Python, Ruby, Smalltalk, etc. In those languages, the only place where the type of a variable is written in code is at instantiation time. I was thinking in the term 'loosely typed languages', but found it a bit, well, loose. References to papers that define nomenclature for this is also welcome.

2

There are 2 answers

2
Juan Vuletich On BEST ANSWER

It is usually called "Duck Typing". See https://en.wikipedia.org/wiki/Duck_typing .

0
Jaroslaw Podgajny On

Languages that do not require type declaration (manifest typing) for variables are called Dynamically Typed. The variables "acquire" type at run-time and it is the type of the object that is assigned to them. The variables can change their type every time a new object is assigned to them.

I reserve Duck Typing to refer to Object Type System only: it allows for "cheaper" implementation of what would normally we achieved with use of formal interfaces.