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

warleyalex warleyalex at yahoo.com.br
Thu Jan 11 13:11:27 CET 2018


Thanks a lot for the feedback.
it worked as expected! The solution was:
/* in DWScript world */var recA : JA;    recB : JB;    recC : JC;for var
k:=0 to 2 do begin  recC.id := k;  recC.name := 'abc'+IntToStr(k);  recC.age
:= 10+k;  recB.field1 := 'rec'+ IntToStr(k);  recB.params.Add(recC); 
recA.fields.Add(recB);end;/* in Pas2JS world */var recA : JA;    recB : JB;   
recC : JC;    k:    Integer;beginfor k:=0 to 2 do begin  recC.id := k; 
recC.name := 'abc'+IntToStr(k);  recC.age := 10+k;  recB.field1 := 'rec'+
IntToStr(k);  TJSArray(recB.params).push(recC); 
TJSArray(recA.fields).push(recB);end;
Take a look at this array of record example, in Smart Pascal world, as long
as the datatypes match (e.g. field params is a array of record), we have the
pseudo methods functionality "built-in" for all arrays, for instance. Pas2JS
could have this high level functionality as well. Using the Pas2JS approach
with external classes interfaces it looks so powerful :)
<http://free-pascal-general.1045716.n5.nabble.com/file/t339674/codeinsight.png> 



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180111/12d40905/attachment.html>


More information about the fpc-pascal mailing list