Hi, I'm the one who made the initial remark.
I'm not certain why Joanna meant to make it a question of sorts, as it's only an observation. And a reason I don't see Pascal as a usable language, due to warts (such as this one) in its featureset.
Pascal will not be fixed anyway, as it is set in stone now, so the best I can hope is its users will move on to better-designed languages, after acquiring a sense for what good design is. (which my posting here might help with)
So here's the problem explained, take two:
In Pascal, I have two options to declare a new type.
I can do an alias, which does nothing but add a name for the same type:
program typeDemo(input, output, stderr);
type vector = record
x: real;
y: real;
end;
type coords = vector;
var v1: vector;
var c1: coords;
begin
// there are no record initializers or what? nevermind, let's do it field by field.
v1.x := 10.0;
v1.y := 5.0;
c1 := v1;
end.
(This compiles; great! That's what was expected, and what I needed.)
Alternatively, I can declare an entirely new type from an existing one:
program typeDemo(input, output, stderr);
type vector = record
x: real;
y: real;
end;
type coords = type vector; // note that I added 'type' here
var v1: vector;
var c1: coords;
begin
// there are no record initializers or what? nevermind, let's do it field by field.
v1.x := 10.0;
v1.y := 5.0;
c1 := v1;
end.
(This fails to compile; great! That's what was expected, and what I needed.)
And of course I can do the same thing with any other type, so:
Let's do an alias again:
program typeDemo(input, output, stderr);
type meters = type real;
type seconds = meters;
var l1: meters;
var t1: seconds;
begin
t1 := 10.0;
l1 := t1;
end.
(This compiles; great! That's what was expected, and what I needed.)
And now I want these to be incompatible, so I add 'type':
(
I badly need a compiler error if I ever assign seconds to meters, say if I'm a physicist)
program typeDemo(input, output, stderr);
type meters = type real;
type seconds = type meters; // note that I added 'type' here
var l1: meters;
var t1: seconds;
begin
t1 := 10.0;
l1 := t1;
end.
This compiles; what gives?! That's completely unexpected, adding 'type' didn't have its effect. In fact it seems to have had no useful effect whatsoever.
It worked with some other type earlier, so this is inconsistent and arbitrary.
Features should work uniformly.
https://en.wikipedia.org/wiki/Principle_of_least_astonishment