Prof A Olowofoyeku (The African Chief) wrote:
This program does not compile. Shouldn't it?
Program attribute_bug;
TYPE Int8 = Integer attribute ( Size = 8 );
WordRec : RECORD Lo, Hi : Cardinal attribute ( Size = 8 ); END;
LongRec = PACKED RECORD Lo, Hi : Cardinal attribute ( Size = 16 ); END;
Begin Writeln ('OK'); End.
Attributes currently don't work in record fields etc. It would be extra effort to recognize them (syntactically). But since one can always declare a type with attributes (such as `Int8') and use this in the record, I'm not conviced whether I should do it ...
One reason against it is that it's not possible in arrays, sets and files because then the following would be ambiguous (does the attribute belong to the array of the component type?). So it might be more consistent to not allow it in any structured types.
type foo = array [1 .. 2] of Integer attribute (...);
Frank