<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">On Thu, Dec 20, 2018 at 1:35 PM Michael Van Canneyt <<a href="mailto:michael@freepascal.org">michael@freepascal.org</a>> wrote:</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">
Yes.<br>
<br>
The reason that we need to wait for type helpers is the following:<br>
<br>
The feature you request requires code to be generated by the compiler, as<br>
the standard Javascript object does not contain the calls you suggest.<br></blockquote><div><br></div><div>Indeed.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
But the external classes do not contain code. <br>
In this sense they are comparable to interface definitions.<br>
<br>
IMO it would not be good design to allow code in an external class definition.<br></blockquote><div><br></div><div>I agree, since it avoid the programmer to chance the original behavior of the imported feature. Class helpers are very welcome here. :-)</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
So, the code cannot go in the external class definition, but it can go <br>
in a type helper, which will then look something like this:<br>
<br>
TObjectHelper = Class helper for TJSObject<br>
constructor new(Values : TJSValueDynArray); varargs; overload;<br>
constructor new(Name : String; Value : JSValue); varargs; overload;<br>
// ++ Some other real killer functions you can think of...<br>
end;<br></blockquote><div><br></div><div>Plus:</div><div><br></div><div>TObjectHelper = Class helper for TJSObject</div><div> constructor new(Values : TJSValueDynArray); varargs; overload;<br> constructor new(Name : String; Value : JSValue); varargs; overload;</div><div> constructor new; varargs; overload; // allowing to create empty objects, like '{}' :-)<br> ...<br>end;<br></div><div><br></div><div>But I have a doubt. If the JS.pas contains the TObjectHelper, will the programmer be able to create his helpers for TJSObject as well?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
So, maybe you still want to change your vote in the poll ? ;-)<br></blockquote><div><br></div><div>Hahaha I'm going to change it. 😀</div></div><div><br></div><div>Thank you for reviewing all the ideas.</div><div><br></div>--<br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div></div></div></div>