[fpc-devel] Language extension: absolute for classes
    Michael Van Canneyt 
    michael at freepascal.org
       
    Sun Oct  1 20:58:53 CEST 2006
    
    
  
On Sun, 1 Oct 2006, Micha Nelissen wrote:
> Michalis Kamburelis wrote:
> > All you want is just to cover in class B identifier "Field" of class A.
> > So you should make "Field" a dummy function in class A (that just
> > returns a field value), and then you can redefine function name in
> > descendant classes. See the example below. Within the scope of class B
> > the "Field" function will return class G.
> 
> This is a smart hack, at best. It's abuse of function syntax IMHO (as if
> they were fields). Second, you cannot assign to a function.
> 
> If the functions were inline, it could be as optimal, I agree; then you
> have essentially localized the typecast to one place.
> 
> I just want to tell the compiler what I can guarantee, but what it
> cannot automatically infer.
> 
> Thank you for the suggestion,
I don't think your solution is any cleaner than what he suggests.
It's also a 'smart hack', after all. Just like in the old DOS days,
when one would declare an array of bytes with 'absolute' at the 
location of the VGA or Hercules text screen card...
Just an opinion, of course...
Michael.
    
    
More information about the fpc-devel
mailing list