On Thu, 11 Jan 2018, warleyalex via fpc-pascal wrote:
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>
In due course, array methods will be added, to get on par with FPC/Delphi. But we have no plans to copy smart pascal extensions. Michael. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal