[Pas2js] Random bugs and observations

Michael Van Canneyt michael at freepascal.org
Fri May 11 10:23:39 CEST 2018



On Fri, 11 May 2018, Ryan Joseph wrote:

>
>
>> On May 11, 2018, at 2:20 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>> 
>> I looked into this. Strictly speaking this is an error in the translation.
>> 
>> This is difficult to translate to pascal.
>> 
>> BufferSource is actually a TJSTypedArray or a TJSArrayBuffer:
>> 
>> https://developer.mozilla.org/en-US/docs/Web/API/BufferSource
>> 
>> Which means that in fact for any function that accepts a BufferSource
>> argument, I should define 2 overloads, one with TJSTypedArray, one with
>> TJSArrayBuffer.
>
> But Float32Array -> TypedArray -> BufferSource right?

Yes, but as said, this is probably wrong.

> gl.bufferData wants TJSBufferSource so shouldn’t Float32Array work? I had this problem other times with other classes. Unless polymorphism doesn’t work the same in JS...

Do you get a compiler error or a run-time error ?

Michael.


More information about the Pas2js mailing list