In the department of wishful thinking:
type
TElement = class(TSomeClass)
Sibling: TElement;
end;
type
LinkAttribute = class(TCustomAttribute)
FLink: TElement;
constructor Create(aLink:TElement);
end;
TContainer = class
X1: TElement;
[Link(X1)] //<– wish I could use an attribute to link X1 with Y1
Y1: TElement;
X2: TElement;
[Link(X2)] //<– wish I could use an attribute to link X2 with Y2
Y2: TElement;
end;
It would be nice if attributes could reference class/record local fields or properties.
I know – it would put a lot of load on the compiler / linker.
If the compiler was two pass, order would not be important.
Since the compiler is single pass – perhaps something like
TContainer = class
[Link(forward Y1)]
X1: TElement;
Y1: TElement;
[Link(forward Y2)]
X2: TElement;
Y2: TElement;
end;
could be an option as well.
You must be logged in to post a comment.