<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi everyone,</p>
<p>This is a very low-level semantic issue, but I'm not particularly
keen on how static methods are defined in classes.</p>
<p><b>class function </b>StaticMethod: Integer; <b>static;</b></p>
<p>What's wrong with it? Well, it's an issue of consistency that
gets me, plus 'static' is only valid as part of a class method
declaration, making it a very restrictive directive. I'm not sure
how best to explain it, but there are three levels of
'connectivity' that a method can have with an object:</p>
<p><b>function </b>RegularMethod: Integer; // Self points to the
calling object<br>
<b>class function </b>ClassMethod: Integer; // Self points to the
calling class<br>
<b>class function </b>StaticMethod: Integer; <b>static;</b> //
Self unavailable - effectively a regular subroutine tied to the
class.</p>
<p>To draw attention to the inconsistency, I doubt anyone would
support syntax like this (or maybe they would... I don't know!):</p>
<p><b>function </b>ClassMethod: Integer; <b>class;</b>
</p>
<p>For one thing, it doesn't immediately jump out that the method is
a class method, especially if there are a lot of parameters and it
scrolls off the edge of the UI. For language consistency, surely
a more logical syntax would be the following:</p>
<p>****<br>
</p>
<p><b>static function </b>StaticMethod: Integer;</p>
<p>****<br>
</p>
<p>For backward compatibility, I would suggest keeping the 'static'
directive for class methods so existing code doesn't break, but
maybe mark it as deprecated.</p>
<p>Granted I can live with it if it isn't going to be changed, but
it's something that always bugged me!</p>
<p>Gareth aka. Kit</p>
<p>P.S. If I've missed something obvious as to why static methods
are implemented using a directive, please educate me!<br>
</p>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
<tr>
<td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
<td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
</td>
</tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>