[Pas2js] Question regarding the New() function (#34736)
silvioprog
silvioprog at gmail.com
Thu Dec 20 17:17:53 CET 2018
On Thu, Dec 20, 2018 at 1:08 PM Mattias Gaertner via Pas2js <
pas2js at lists.freepascal.org> wrote:
> Note: To avoid the array brackets and name conflicts, it could be
> defined like this:
> function new(Name:string; value:jsvalue): TJSObject; varargs; overload;
>
Yes, I've tried variadic function. :-)
It is a good idea, but remember:
var o = {};
so it would necessary:
o := new;
but the function(<Name>;<Value>) obligates to pass at least a pair. :-)
> I don't want too much "tricks" in the compiler. If later we can think
> > of a way to do this in a good pascal-ish manner, we'll of course do
> > it.
>
> Are you speaking of the "external name '{}'"?
> The direct {} notation requires compiler magic.
Yes. It would be useful.
--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20181220/09f714df/attachment.html>
More information about the Pas2js
mailing list