[TYPES] The type/object distinction and possible synthesis of OOP and imperative programming languages

Ian Kelly ian.g.kelly at gmail.com
Tue Apr 16 19:52:46 EDT 2013


On Tue, Apr 16, 2013 at 5:16 PM, Mark Janssen <dreamingforward at gmail.com> wrote:
> Understood, but I feel this is where theory has gone too far away from
> reality.

How so?  Turing machines and lambda calculus were both invented in the
30s, before any real mechanical computers existed.  If anything, it is
programming that has strayed too far from theory. ;-)

> While I understand the interest in purely theoretical models, I wonder
> two things:  1)  Are these distinct models of computation valid?

If they provide an algorithmic/mechanical means of solving problems,
then they are valid models of computation.  An abacus is a valid model
of computation, although I wouldn't want to compute a million digits
of pi on it.  I may be missing what you really mean by "valid" here.

> 2) If so, shouldn't a theory of types announce what model of
> computation they are working from?
>
> You say the C/C++ model is the exception, but in the programmer
> community (excepting web-based languages) it is the opposite.  The
> machine model dominates.

In C/C++ the types are based on the hardware.  You have 16-bit ints
and 32-bit ints and 64-bit floats and what not because those are the
types that fit neatly in the storage units of the hardware.

In higher-level languages like Python, the types are abstract, not
based on the hardware.  Python doesn't have 32-bit ints, except as an
implementation detail that the programmer need not be aware of.
Python ints have arbitrary precision.

> In fact, I'm not even sure how Java
> operates, but through some sorcery I don't want to take part in.

It compiles to an intermediate language that is executed by a virtual
machine, much like Python.



More information about the Python-list mailing list