[fpc-pascal] PAS2JS: operations with array of record

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Jan 11 13:26:09 CET 2018


On Wed, 10 Jan 2018 11:40:48 -0700 (MST)
warleyalex via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:

> Since it's missing the Pas2JS specific forum, I don't know if here is correct
> place to post things about "Pas2JS". 

Hopefully there will be one soon.

 
> I'm using it a lot and it's very promising. I came across with issue when
> dealing with array of records. 
> 
> I would like to convert this little piece of DWScript code to Pas2JS,
> unfortunately, I couldn't find a way how to push an array of record. For
> instance:
> type 
>   JC = record 
>      id : integer; external 'id'; 
>      name : string; external 'name'; 
>      age : integer; external 'age'; 
>   end; 

Why the 'external' modifiers?

> ...using JS object instead of function for record...
> I believe it will be nice if PAS2JS could generate similar code,

It's on the todo list.


> I don't know, I believe it will achieves better performance using
> ordinary arrays, at least.

And it is useful for many JS functions expecting an enumerable
object.


Mattias



More information about the fpc-pascal mailing list