[Pas2js] Random bugs and observations

Ryan Joseph ryan at thealchemistguild.com
Fri May 11 07:23:03 CEST 2018


Sorry for the long list. :)

1) for..in doesn’t work with JSArray (see #4)

2) += doesn’t work for integers. not implemented yet?

3) Can we implement sizeof to make working with TypedArrays easier (even just for primitives would be good)? I know it’s mainly WebGL related but that would be useful.

4) JSArray really needs to be a “toll free bridge” to Pascal arrays. 
	- Any JS function that takes JSArray as an argument should accept Pascal dynamic arrays. JS would accept any array so why are we type casting from Pascal if we use array of xxx instead of JSArray?
	- If we use JSArray then we need to cast for for..in to work right? That’s not very good obviously.
	- Pascal dynamic arrays should probably have JSArray functions built-in since they are aliases for JSArrays anyways. It’s actually a feature of Pascal that we can do “array of integer” and get an error if we attempt to push a non-integer value to the array so we should take advantage of that.

5) should string and TJSString by toll free bridged also? I’m already having type casting problems using Pascal strings and passing to JS functions even though they are the same type internally. String concatenation between the types doesn’t seem to work either which doesn’t seem right.

6) when using other units is it really necessary to import all that extra code that the main program imports anyways? As it stands it appears each unit is going to be 2000+ plus lines.

7) halt doesn’t work. How should we bail out of the script on a fatal error?

8) “text” property of TJSElement doesn’t exist.

9) bytes is TJSUInt8Array but can’t be passed to a method expecting TJSBufferSource even though it’s a subclass of TJSBufferSource. Casting to TJSBufferSource doesn’t work either and gives nonsensical message.
	gl.bufferData(gl.ARRAY_BUFFER, bytes, gl.STATIC_DRAW);

10) error is type integer but the case statement checking for the constant TJSWebGLRenderingContextBase.INVALID_VALUE doesn’t work. gl.getError returns integer in webgl.pas which should map to those constants. Type casting to NativeInt doesn’t work either but a if statement does work (if error = gl.INVALID_VALUE).
	case error of
		gl.INVALID_VALUE:

11) browser says UInt8Array is not defined. Is that a problem with pas2js not importing something?


Regards,
	Ryan Joseph



More information about the Pas2js mailing list