<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body smarttemplateinserted="true">
<div id="smartTemplate4-template">Hi,<br>
</div>
<div><br>
</div>
<div>the parameter is already optional without any modifier, since
you can always pass nil for it.</div>
<div><br>
</div>
<div>Perhaps there could be the opposite modifier, so the function
cannot be called with nil. Like<br>
</div>
<div>
<pre class="moz-quote-pre" wrap="">procedure DoThis(nonnil var obj: TObject); </pre>
<p>and then you need to check if it is nil, before calling DoThis
.<br>
</p>
</div>
<div><br>
</div>
<div>Or you put it in the type. type TSomeObject = nonnil
class(TObject)... and then it would never be allowed to be nil. <br>
Or for pointers type PDude = nonnil ^TDude; <br>
If you would want to use such a nonnil class as field in another
class, you would need to initialize it in the constructor.<br>
</div>
<br>
<div><br>
</div>
<div><br>
Bye,<br>
Benito </div>
<br>
<div class="moz-cite-prefix">Am 13.04.19 um 09:47 schrieb Sven Barth
via fpc-pascal:<br>
</div>
<blockquote type="cite"
cite="mid:CAFMUeB-D70xmat=4wS9dOooeWXfeg4DMM8WSJV69g208DmXoSg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">
<div class="gmail_quote" dir="auto">
<div dir="ltr" class="gmail_attr">Marco van de Voort <<a
href="mailto:fpc@pascalprogramming.org"
moz-do-not-send="true">fpc@pascalprogramming.org</a>>
schrieb am Fr., 12. Apr. 2019, 20:56:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Op 2019-04-12 om 17:23 schreef Ryan Joseph:<br>
> <br>
> What do you think of that? Sounds like an easy way to
get some support for nil pointers deref’s and provides self
documenting code.<br>
<br>
I think the same as when I read the suggestion for an inout
variant of <br>
VAR. Move this out of the language syntax, and make it
directives or <br>
attribute like syntax (like we will need to get anyway for
const ref).<br>
</blockquote>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Im definitely for new syntaxes (or the attribute
one) than a directive. A directive can be anywhere and I'd
need to go looking for it if I want to know whether it is set
or not. Some syntax extension would be right at the
declaration. </div>
<div dir="auto"><br>
</div>
<div dir="auto">So, yeah, we'll probably compromise towards the
attribute syntax... </div>
<div dir="auto"><br>
</div>
<div dir="auto">Regards, </div>
<div dir="auto">Sven </div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a></pre>
</blockquote>
</body>
</html>