[Pas2js] Testing generics

Ben Grasset operator97 at gmail.com
Tue Oct 22 23:14:01 CEST 2019

On Fri, Oct 18, 2019 at 5:23 PM Michael Van Canneyt <michael at freepascal.org>

> At least TJSArray and TJSPromise are on my list for replacement with
> generic
> types, as well as TTypedArray and friends. For backwards compatibility I'll
> keep the current classes as specializations with JSValue.
> Do you have other classes in mind that could be usefully replaced/enhanced
> with
> a generic variant?

There's a fair number overall. I actually have a "JSGenerics" unit I made
for the purposes of playing around with generics in Pas2JS that I could
submit as a patch for you to look at, if you want.

It currently has full generic translations of the following class
definitions from JS.pas (prefixed like "TGJS" instead of "TJS" to avoid any
name conflicts):

- TJSIteratorValue
- TJSIterator
- TJSSet
- TJSMap
- TJSFunction
- TJSArray
- TJSArrayBuffer
- TJSBufferSource
- TJSTypedArray
- TJSPromise
- TJSFunctionArguments

The various callback type aliases are included as well (under "public type"
in the relevant class instead of globally, to avoid the forward-declaration
problem with generics.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20191022/4cf4705c/attachment.html>

More information about the Pas2js mailing list