[fpc-pascal] Re: Procedures in records not supported :(

Skybuck Flying skybuck2000 at hotmail.com
Sat Feb 9 21:50:39 CET 2008


Not quite buster !

// *** Demo problem begin ***

type
 TmyRecord = record
  A,B,C,D,E,F : integer;
 end;
 
 TmyObject = object
  A,B,C,D,E,F : integer;
  
  procedure Test;
 end;

procedure TmyObject.Test;
begin
 A := 5;
end;


begin
 writeln( SizeOf(TmyRecord) );
 writeln( SizeOf(TmyObject) );
 
 TmyObject.Test; // not allowed, does not compile

end.

// *** Demo problem end ***

The test routine of Tobject cannot be called directly.

It needs probably two things to work:

1. A object instance variable declaration

2. And probably a constructor and destructor call.

This is very bad because it adds much complexity and overhead.

I don't want to manage memory/objects, constructions/destructions.

I just wanna call:

TmyRecord.Test;

Without having to instantiate anything.

That's exactly what Delphi allows me to do.

So it's definetly a new future never seen before ! ;)

And to boldly go where no-one has gone before ! ;) =D

Startrek-tng allll the way baby ;)

Bye,
  Skybuck.



More information about the fpc-pascal mailing list