[Pas2js] Question regarding the New() function (#34736)

silvioprog silvioprog at gmail.com
Thu Dec 20 17:23:45 CET 2018


On Thu, Dec 20, 2018 at 1:09 PM Michael Van Canneyt <michael at freepascal.org>
wrote:

> On Thu, 20 Dec 2018, silvioprog wrote:
> > ... a pascal-ish manner, should be:
> >
> > var
> >  o: TJSObject;
> > begin
> >  o := TJSObject.new([
> >    'foo', 'bar',
> >    'object', TJSObject.new(['abc', 123]),
> >    'array', TJSArray.new(1,2,3)
> >  ]);
> >  Writeln(TJSJSON.stringify(o));
> > end.
>
> I agree. When we have type helpers, this will be possible.


Great! :-)

The parametrized constructor is already possible in TJSArray.new(), on each
parameter is an array item, but it will be very useful something like this
in TJSObject.new() too, on each item is a pair (key-value) and without the
brackets. :-)

--
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20181220/7ee90e5f/attachment.html>


More information about the Pas2js mailing list