The documentation states:
When you declare a type that is identical to an existing type, the
compiler treats the new type identifier as an alias for the old one.
Thus, given the declarations:
type TValue = Real;
var
X: Real;
Y: TValue;
X and Y are of the same type; at runtime, there is no way to
distinguish TValue from Real. This is usually of little
consequence, but if your purpose in defining a new type is to utilize
runtime type information, for example, to associate a property editor
with properties of a particular type - the distinction between
'different name' and 'different type' becomes important. In this case,
use the syntax:
type newTypeName = type KnownType
For example:
type TValue = type Real;
forces the compiler to create a new, distinct type called TValue.
It is not terribly common to need to create a distinct type rather than an alias. However, there are occasional uses. The best example I can think of is to consider the Windows types HDC and HWND. These are both pointer sized opaque values. So it would seem reasonably to define them like this:
type
HDC = Pointer;
HWND = Pointer;
However this means that variables of these types are assignable to each other. It makes no sense to pass an HDC to GetDC() and, vice versa, it makes no sense to pass and HWND to ReleaseDC().
So you could delcare the types like this:
type
HDC = type Pointer;
HWND = type Pointer;
Now the languages type system can prevent you from making such banal mistakes and let you get on with real programming.
Another excellent example is given by Andreas and Remy in the comments to the question:
TCaption has a different property editor implemented that allows real-time updates, as you type in the Object Inspector. That is possible because of type TCaption = type string. That would not be possible with type TCaption = string.
Caption: TCaptionproperty (of aTFormorTLabel, say) causes a repaint on the control as you type in the object inspector at design time, while a regularText: stringdoes not? Now, this distinction would not be possible iftype TCaption = string. - Andreas RejbrandTCaptionhas a different property editor implemented that allows real-time updates. That is possible because oftype TCaption = type string;. That would not be possible withtype TCaption = string;. - Remy Lebeau