<div dir="ltr"><div dir="ltr">On Mon, Dec 24, 2018 at 7:01 PM Mattias Gaertner via Pas2js <<a href="mailto:pas2js@lists.freepascal.org" target="_blank">pas2js@lists.freepascal.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, 21 Dec 2018 22:50:01 +0100 (CET)<br>
Michael Van Canneyt <<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>> wrote:<br>
<br>
>[...]<br>
> > Why forbid it for Pascal functions? <br>
> The purpose of pas2js is to allow pascal to run in the browser. <br>
> The purpose is not to make pascal behave like Javascript. <br>
> I want to bend Javascript, not bend pascal. So if we really must bend<br>
> pascal to accomodate interaction with external JS code, <br>
> I prefer it limited to that use case alone :-)<br>
<br>
Good point.<br>
<br>
In that case the default value is not needed and syntax could be:<br>
<br>
procedure f(w: jsvalue = JSOmitArg); external name 'f';<br>
<br>
where JSOmitArg is a special value that is omitted.<br>
Advantage: no need to adapt Delphi/Lazarus.<br>
<br>
Mattias</blockquote></div><div><br></div><div>That would be great.</div><div><br></div><div>Will it be compatible to other types? E.g:</div><div><br></div><div>procedure f(w: Integer = JSOmitArg); overload; external name 'f';<br></div><div>procedure f(w: string = JSOmitArg); overload; external name 'f';</div><div><br></div><div>In the example above only Integers and Strings are allowed in f().</div><div><br></div><div>p.s: JSDefault could be an option too. :-) E.g:</div><div><br></div><div>procedure f(w: JSValue = JSDefault); external ...<br></div><div><br></div>--<br><div dir="ltr" class="m_-1699676955360154925m_2561367324157192474m_-1602334558444775620m_-3330617293825243715gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div></div>