[Pas2js] Testing generics

Michael Van Canneyt michael at freepascal.org
Fri Oct 18 23:23:30 CEST 2019

On Fri, 18 Oct 2019, Ben Grasset wrote:

> Nice work! I'm not much of a web person myself, but I find Pas2JS
> interesting, so I've been following the development pretty closely.

I've meanwhile done 2 commercial  web projects with it, and development goes
amazingly fast.

The start of webwidgets which I committed earlier have been enhanced very much meanwhile,
and I will publish the enhancements in the near future, together with a demo

The template loader/component is in fact the workhorse doing the bulk of the
work and in combination with bootstrap CSS you can have an application up and running
in no time.

But the biggest help have been the dataset classes, combined with a REST or
Remobjects Data Abstract backend..

> FYI: I've done a lot of experimentation with generics, and have found that
> basically all the classes that directly represent ones from Javascript
> (like TJSArray and so on) can be re-defined as generic (so that all the
> instances of "JSValue" become "T") and it works just as well as what you
> might expect from TypeScript (where everything has pretty much always been
> defined as generic.)

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?


More information about the Pas2js mailing list