From: Frank Heckenbach heckenb@mi.uni-erlangen.de Date: Thu, 7 May 1998 13:23:02 +0200 To: gpc@hut.fi, jola@csd.uu.se Subject: Re: Reformatted: EFLIB as class library for Object-Pascal (fwd)
[...]
- Properties: I have them listed in my To-Do-list (http://fjf.gnu.de/gpc-todo_toc.html), but I personally don't know too much about them.
I know a bit about them ;)
Are they a Delphi extension?
Yes.
If so, are there any documents available to describe them,
I suppose the Delphi help files would document them - but I don't know of any other documentation. I believe that there are copies of the Delphi VCL help file on Borland's homepage (ps: Borland is now called "Inprise").
or otherwise, could some Delphi user put together a list of features required that could be used as a "standard" that GPC, and perhaps FPK, can implement?
AFAICS, properties are special things which pretend to be fields, but which are actually methods. You can make them read/write or readonly, etc. It is best explained by example, because I am not sure that I am very good at explaining the concept. This is an example;
Type foo = Class(TClass)
private {by Delphi convention, fields to be used in properties are private and should not be accessed directly, but this is not necessary} fName:string; fNum:integer;
Public Constructor Create;override; Destructor Destroy;override;
{the next 4 methods service the properties and are not normally called directly - the compiler handles calls to them when properties are accessed} Procedure SetName(aName:string); Function Getname:string; Procedure SetNum(Num:integer); Function GetNum:integer;
Published {can be published or public; if published it will show in the GUI designer} Property FileName: string read Getname write SetName; Property FileNumber:integer read GetNum write SetNum; end;
Constructor foo.Create; begin Inherited Create; fName:=''; fNum := 0; end;
Destructor foo.Destroy; begin Inherited Destroy; end;
Procedure foo.SetName(aName:string); begin fName:=aName; end;
Function foo.Getname:string; begin Result := fName; end;
Procedure foo.SetNum(Num:integer); begin fNum := Num; end;
Function foo.GetNum:integer; begin Result := fNum; end;
Var bar:foo; x:integer; Begin bar := foo.Create; With bar do begin FileName := 'Chief'; {write access - compiler calls SetName} FileNum := 200; end; {write access - compiler calls SetNum} {blah ...; blah ....;} Writeln(FileName); {read access - compiler calls GetName} x := FileNum; {read access - compiler calls GetNum} Free; {inherited method - calls destructor Destroy} End.
I hope this simple (and untested) example gives you the idea of hat you need to implement.
- Classes: At http://pascal-central.com/OOE-stds.html, there is a draft for an ANSI Object Pascal standard. AFAIH, Delphi's implementation is quite close to this standard. One of the plans for GPC is to implement this standard draft without dropping the BP object model that is already implemented, in the hope that there won't be great conflicts between the two.
That would be the best approach. It is the approach that Delphi takes.
- Exception handling: I myself would like to use it (for OOP as well as non-OOP programs), so I'd be willing to put some effort into implementing it when I have the time (later this year, hopefully). However, as with properties, I'm lacking a (pseudo-)standard. I do know the Java exception handling, and I think it's not too bad and could be implemented similarly in Pascal. OTOH, I read that the latest GCC version (on which GPC is based) has introduced exception handling, so it might be easier to implement this if we can reuse that code. OTTH, if there already is an implementation in a Pascal dialect (Delphi?), and it's suitable, it would be a good idea to be compatible to this. So again, could someone make a list of required features (perhaps with some sample code)?
Delphi has exceptions (implemented in exception Classes). However, I do not use them. I prefer to use the good old "Ioresult"
Best regards, The Chief -------- Dr. Abimbola A. Olowofoyeku (The African Chief) Email: laa12@keele.ac.uk Homepage: http://ourworld.compuserve.com/homepages/African_Chief/ Author of: Chief's Installer Pro 4.25 for Win16 and Win32: ftp://ftp.simtel.net/pub/simtelnet/win3/install/chief425.zip