Re:Language Design: Use 'ident: Type' not 'Type ident'
by dllthomas on Saturday May 02, 2020 @04:24PM
(#23054634)
I don't think that actually breaks things. A typedef isn't purely syntactic substitution like a macro.
If we have
typedef float *floatp;
then the following compiles:
float x, y;
floatp xp = &x, yp = &y;
while the following does not:
float x, y;
float* xp = &x, yp = &y;
You have defined a new type (which happens to be equivalent to an old type - note that we don't get nominal type-checking from typedefs); the above logic still holds.
If we have
then the following compiles: while the following does not: You have defined a new type (which happens to be equivalent to an old type - note that we don't get nominal type-checking from typedefs); the above logic still holds.