Talk:GolfmlClass

From Lazarus wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

InitOK

(Note: have not looked at the actual implementation) Hi - in your example you show this for creating the class:

GolfmlClass:=TGolfMLClass.Create; 
If NOT GolfmlClass.InitOK then Halt;

Why the need to call InitOK? Would it make sense for the TGolfMLClass constructor to call InitOK by itself?

Then perhaps the entire InitOK procedure can be moved to a private procedure, leaving just the Reset code for an end user to use...

Thanks, --BigChimp 08:37, 27 May 2014 (CEST)

-> InitOK and Reset both call a protected method that sets up the arrays and (unnecessarily) sets zero values to lots of private variables.

-> At the time of writing, I didn't know that fpc's Create method initialises all variables and arrays automatically. It's a one-line edit to call prot_InitOK in the create method, but I have left the code 'as-is' so that the programmer can verify the class has initialised properly via a return value (which Constructors lack) I agree it's a bit old-school :)

-> golfml is a clever open XML schema which has failed to 'take off' with golf application developers - AFAIK there is no other. --Torrenter