What is Expressiveness in a Computer Language

George Neuner gneuner2/ at comcast.net
Sun Jun 25 09:26:33 CEST 2006


On 22 Jun 2006 08:42:09 -0700, rossberg at ps.uni-sb.de wrote:

>Darren New schrieb:
>> I'm pretty sure in Pascal you could say
>>
>> Type Apple = Integer; Orange = Integer;
>> and then vars of type apple and orange were not interchangable.
>
>No, the following compiles perfectly fine (using GNU Pascal):
>
>  program bla;
>  type
>    apple = integer;
>    orange = integer;
>  var
>    a : apple;
>    o : orange;
>  begin
>    a := o
>  end.

You are both correct.  

The original Pascal specification failed to mention whether user
defined types should be compatible by name or by structure.  Though
Wirth's own 1974 reference implementation used name compatibility,
implementations were free to use structure compatibility instead and
many did.  There was a time when typing differences made Pascal code
completely non-portable[1].

When Pascal was finally standardized in 1983, the committees followed
C's (dubious) example and chose to use structure compatibility for
simple types and name compatibility for records.


[1] Wirth also failed to specify whether boolean expression evaluation
should be short-circuit or complete.  Again, implementations went in
both directions.  Some allowed either method by switch, but the type
compatibility issue continued to plague Pascal until standard
conforming compilers emerged in the mid 80's.

George
--
for email reply remove "/" from address



More information about the Python-list mailing list