[Pas2js] Heads up: possibly breaking change.

Michael Van Canneyt michael at freepascal.org
Sat May 8 17:45:43 CEST 2021


Hello,

The format() function in pas2js was created when the pas2js compiler did not
yet support 'array of const'. It was emulated using array of jsvalue.

All functions that somehow called Format() had also been changed to use 
Array of JSValue were also changed.

The 'array of const' construct is now supported since some time, 
and the Format() function is now working with Array of const for 
FPC/Delphi compatibility.

I have carefully tested all the demos, and the compiler itself
(which is able to compile itself) and fixed all cases where Array of JSValue
was used.

Practically, this should not affect your code, unless you yourself also had
an 'Array of JSValue' which you passed on to Format. In that case, you will
need to change the 'Array of JSValue' to 'Array of const': 
The compiler does not automatically convert one to the other, 
you will get a compiler error.


As this change is invasive, it will not be ported to the 2.0.x series, 
but will only appear in the 2.2 release of pas2js.

If you find a spot in the pas2js codebase which I missed, please let me know.

Michael.


More information about the Pas2js mailing list