[Pas2js] Testing generics

Ben Grasset operator97 at gmail.com
Fri Oct 18 21:37:09 CEST 2019

On Thu, Oct 17, 2019 at 5:48 PM Michael Van Canneyt <michael at freepascal.org>

> Hm. I am amazed and pleasantly surprised.
> Do you ever sleep ?
> You're much farther than I expected. The todo list is actually quite short.
> 3 questions:
> 1. Should we notify Bruno or do you think it is better to wait ?
>    He asked about progress on the phone yesterday, I said I'd investigate
>    but I think the answer is now quite clear, so not much investigation is
> needed.
> 2. Do you think the fgl unit can be ported ?
> 3. I saw you created simple version of some generics routines. Do you think
>     it is already possible to port the rtl-generics units ?
>     TMS Software and wagner Landgraf in particular use these units.
> In each case, congratulations on the huge progress you made !
> Michael.
> On Thu, 17 Oct 2019, Mattias Gaertner via Pas2js wrote:
> > Hi,
> >
> > pas2js trunk now supports generics.
> > Here is a list of features, what should work and what not:
> >
> > https://wiki.lazarus.freepascal.org/pas2js_Generics
> >
> > As demonstration I added the generic TList<T> in the rtl units:
> > generics.collections.pas
> > generics.defaults.pas
> > generics.strings.pas
> >
> > Now I'm searching some brave adventurers to test this alpha feature and
> > report bugs.
> >
> >
> > Mattias
> > _______________________________________________
> > Pas2js maillist  -  Pas2js at lists.freepascal.org
> > https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
> _______________________________________________
> Pas2js maillist  -  Pas2js at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js

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.

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

Personally, I don't see too much of a need for anything like generic
classes ported over from Pascal, as for example the generic version of
TJSArray does everything TList<T> does (more, actually!)

I'm sure there are people out there who'd like a more complete version of
rtl-generics in Pas2JS though, so it's probably worth doing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20191018/d6d69b55/attachment.html>

More information about the Pas2js mailing list