Difference between revisions of "Talk:GolfmlClass"
m |
m (Fixed syntax highlighting) |
||
(One intermediate revision by one other user not shown) | |||
Line 2: | Line 2: | ||
(Note: have not looked at the actual implementation) | (Note: have not looked at the actual implementation) | ||
Hi - in your example you show this for creating the class: | Hi - in your example you show this for creating the class: | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang=pascal> |
GolfmlClass:=TGolfMLClass.Create; | GolfmlClass:=TGolfMLClass.Create; | ||
If NOT GolfmlClass.InitOK then Halt; | If NOT GolfmlClass.InitOK then Halt; | ||
Line 13: | Line 13: | ||
--[[User:BigChimp|BigChimp]] 08:37, 27 May 2014 (CEST) | --[[User:BigChimp|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. | + | -> 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 :) | + | -> 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. | + | -> golfml is a clever open XML schema which has failed to 'take off' with golf application developers - AFAIK there is no other. |
--[[Torrenter]] | --[[Torrenter]] |
Latest revision as of 12:44, 16 February 2020
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