[erlang-questions] Why is Erlang what it is?

Richard Carlsson <>
Fri Dec 22 18:26:28 CET 2006


Serge wrote:
> Could you please define "strict typing" more verbosely.  According to
> wikipedia (http://en.wikipedia.org/wiki/Type_system) there are primarily
> three typing groups:
> 
> 1. Static and dynamic typing
> 2. Strong and weak typing
> 3. Safely and unsafely typing
> 
> What is "strict typing" then?  Dynamic + strong + safe?  Are there any
> references that discuss this type definition?

I should apparently be even more careful with the words I use.
The intended meaning, as related to the classification above, was
"strongly typed". (Googling for "strictly typed" shows that many
people seem to have used these words in that sense, but I should
have known better. ...slaps fingers of self...)

So what does it mean? Static/dynamic is a separate issue, and I
had actually never before seen "safely/unsafely" used as a separate
classification before (except for more specialized type systems, e.g.
for checking safety of byte code) - it is usually (in my experience at
least) assumed that "strong/weak" has much more to do with type _safety_
than with whether implicit casts are allowed, so I don't really agree
with the Wikipedia entry - but then, I'm not an expert.

If you've been reading in Wikipedia, you might also have seen the
separate entry on "Strongly-typed programming language". Let me
quote it here:

``the term strong typing is used to describe how programming languages
handle datatypes. The antonym is weak typing. However, these terms have
been given such a wide variety of meanings over the short history of
computing that it is often difficult to know what an individual writer
means by using them.

Programming language expert Benjamin C. Pierce, author of Types and
Programming Languages and Advanced Types and Programming Languages, has
said:
    `I spent a few weeks... trying to sort out the terminology of
    "strongly typed," "statically typed," "safe," etc., and found it
    amazingly difficult.... The usage of these terms is so various as
    to render them almost useless.'

Most generally, "strong typing" implies that the programming language or
implementation enforces some kind of constraints upon programs,
preventing them from running code which uses data in an invalid way.
[...] However, the nature and strength of these constraints is highly
variable.''

(http://en.wikipedia.org/wiki/Strongly-typed_programming_language)

My personal view of what "strongly typed" (or more sloppily, "strictly
typed") means is basically that:
  - every concrete value will have a known specific type
  - you cannot re-interpret the bit pattern of a value (or access
    memory that does not contain a proper value), i.e., the only
    allowed casts, implicit or explicit, are those that convert
    the representation as necessary - no casting of pointers

In that sense, Erlang is strongly (an dynamically) typed, while
something like BCPL would be an example of a weakly typed language.

    /Richard



More information about the erlang-questions mailing list