[Pas2js] Random bugs and observations

Mattias Gaertner nc-gaertnma at netcologne.de
Fri May 11 08:41:29 CEST 2018


On Fri, 11 May 2018 12:23:03 +0700
Ryan Joseph <ryan at thealchemistguild.com> wrote:

> Sorry for the long list. :)

Who writes lists gets short answers. If you want long answers create
proper mails with subjects.

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

Report bug.

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

Report bug.

 
> 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.

No. Maybe with a compiler directive.

 
> 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.

There is no short answer.


> 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.

typeof(new String()) === 'object''

 
> 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.

Report bug.

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

I'm not aware of a JS equivalent.

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

That's for Michael.

 
> 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);

Report bug.

 
> 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:

Report bug.

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

No.

Mattias


More information about the Pas2js mailing list