[Pas2js] Pas2js 0.9.20

Michael Van Canneyt michael at freepascal.org
Sat May 12 10:45:22 CEST 2018



On Sat, 12 May 2018, Ryan Joseph wrote:

>
>
>> On May 12, 2018, at 3:32 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>> 
>> You must typecast a JSValue.
>> 
>> if i = Integer(JSValue) then
>
> we’re stuck in this weird middle ground with Pascal to JS because it feels
> like “i" should equal JSValue but in Pascal syntax there’s no such
> equivalent.  Likewise at least as JS RTL functions are written “array of
> JSValue” feels like it should make sense and basically just be an alias to
> TJSArray, which is of course an array of JSValue’s.

I understand what you're saying.

My guideline in this is that JSValue must be avoided as much as possible, 
to be used only in case of absolute need.

Once more, the purpose is to make Pascal run in the browser. 
Not to make every possible Javascript construct possible in Pascal.

Some Javascript APIs make heavy use of the Javascript paradigm, and there
finding a suitable pascal equivalent is difficult. But by and large, I find
this limited. The typical Javascript program does not use a typed array.
(some notable exceptions are WebGL and maybe some image manipulations or
cryptographic stuff)

Michael.


More information about the Pas2js mailing list