https://wiki.freepascal.org/index.php?title=User_talk:Crore&feed=atom&action=historyUser talk:Crore - Revision history2024-03-29T15:08:08ZRevision history for this page on the wikiMediaWiki 1.35.6https://wiki.freepascal.org/index.php?title=User_talk:Crore&diff=138561&oldid=prevCrore: Reasoning for changing Record - Variable structure example2020-07-29T15:43:39Z<p>Reasoning for changing Record - Variable structure example</p>
<p><b>New page</b></p><div>== Record: Variable structure ==<br />
<q><code>Single</code> was used as identifier in a set! This is not recommended in Pascal. So I changed all identifiers in set 'maritalStates' to be prefixed with 'ms_'.</q><br />
<br />
Response from [[User:Kai_Burghardt]] for undoing this change:<br />
<q>keep it simple [and Pascal does not define “single”, so there’s no reason not to name an identifier like that]</q><br />
<br />
# Take a look at [[Record#Variable_structure]] and you notice that <code style="color: red">single</code> is colored red. So this item has a meaning in pascal formatting. This is not good in an example, because noone should wonder why a maritalState is related to ObjectPascal.<br />
# Take a look at [[Data_type#Floating-point_types]]: in freepascal <code>real</code> is platform dependent. I would not recommend to use it. In the whole unit math you wouldn't find any <code>real</code>. Also <code>Single</code> is defined in fpc/3.0.4/source/rtl/win64/system.pp according to Lazarus hint, although you are free to redefine it as it is done here. Also not good in an example. And then you should at least mention it.<br />
# If you paste the example in a new application and define somewhere: <syntaxhighlight lang="pascal">Income : Single;</syntaxhighlight>the user gets: <code>Error in type definition</code>. Why would you introduce a source of unexplainable errors to new users?<br />
# Also it's good practice to prefix your enumerated type identifiers like: <code>bsSolid, vk_Escape, pf32bit</code>. Why not show good programming style to new users?<br />
# There is nothing ''simple'' in not using the last mentioned point. Instead, this would improve the readibility of the code - that is simple.</div>Crore