<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello,<div><br></div><div>Since this feature is planned to be implemented, I have a question about the possibility to declare multiple helpers for the same type. I suspect you will implement it extending the object prototype, but it seems multiple type helpers are not allowed in Pascal code. For example, consider the following code:</div><div><br></div><div><div><font face="monospace, monospace" size="1">uses SysUtils;</font></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="monospace, monospace" size="1">begin</font></div><div><font face="monospace, monospace" size="1">  ShowMessage(Integer(123).ToString);</font></div><div><font face="monospace, monospace" size="1">end.</font></div></div><div><br></div><div>it compiles and runs fine, but, if you declare another helper:</div><div><br></div><div><div><font face="monospace, monospace" size="1">uses SysUtils;</font></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="monospace, monospace" size="1">type</font></div><div><font face="monospace, monospace" size="1">  TMyIntegerHelper = record helper for Integer</font></div><div><font face="monospace, monospace" size="1">    function ToString2: string;</font></div><div><font face="monospace, monospace" size="1">  end;</font></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="monospace, monospace" size="1">function TMyIntegerHelper.ToString2: string;</font></div><div><font face="monospace, monospace" size="1">begin</font></div><div><font face="monospace, monospace" size="1">  Result := Concat('my', IntToStr(Self));</font></div><div><font face="monospace, monospace" size="1">end;</font></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="monospace, monospace" size="1">begin<br></font></div><div><font face="monospace, monospace" size="1">  ShowMessage(Concat(Integer(123).ToString, ';', Integer(123).ToString2));</font></div><div><font face="monospace, monospace" size="1">end.</font></div></div><div><br></div><div>it can't compile:</div><div><br></div><div><font face="monospace, monospace" size="1">Unit1.pas: E2003 Undeclared identifier: 'ToString'</font><br></div><div><br></div><div>however, in the Pas2JS it should be supported, and the result would be:</div><div><br></div><div><font face="monospace, monospace" size="1">123;my123</font></div><div><br></div><div>A small example in JS extending the Date prototype, very close to our type helper, but allowing multiple declarations:</div><div><br></div><div><div><font face="monospace, monospace" size="1">Date.prototype.toMyString = (function() {</font></div><div><font face="monospace, monospace" size="1">  return "My " + this.toString();</font></div><div><font face="monospace, monospace" size="1">});</font></div><div><font face="monospace, monospace" size="1">var event = new Date("August 19, 1975 23:15:30");</font></div><div><font face="monospace, monospace" size="1">console.log(event.toString(), ";", event.toMyString());</font></div></div><div><br></div><div>it prints:</div><div><br></div><div><font face="monospace, monospace" size="1">Tue Aug 19 1975 23:15:30 GMT-0300 ; My Tue Aug 19 1975 23:15:30 GMT-0300</font><br></div><div><br></div><div>Many JS plugins works extending prototype, and we can use multiple plugins simultaneously, so it should be supported in Pas2JS mode. :-)</div><div><br></div><div>Best,</div><div><br></div><div>--<br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div></div></div></div></div></div></div></div></div></div>