[fpc-devel] Language extension: absolute for classes
Michael Van Canneyt
michael at freepascal.org
Sun Oct 1 22:28:02 CEST 2006
On Sun, 1 Oct 2006, Micha Nelissen wrote:
> Marco van de Voort wrote:
> >> Changing type to something which is not a descendant (and thus
> >> incompatible) seems useless and always dangerous to me, so should be
> >> forbidden if possible.
> >
> > I also considered it that way. But maybe the "absolute" keyword is then a
> > bit badly chosen, since it implies memory overlaying, no questions asked.
>
> Yes, agree, but the way of use is so similar. Maybe the other usages
> should get this checking as well ;-).
>
> Maybe 'override' instead, but that one is so closely tied to functions,
> and implies something 'virtual' as well.
If you do it for fields of class type only, then I think this is OK.
Declare the field as virtual, and require it to be 'overridden' in the
descendent class.
Michael.
More information about the fpc-devel
mailing list