[Pas2js] Testing generics
Pedro Pablo Oviedo Vera
verakuba13 at gmail.com
Tue Oct 22 14:20:20 CEST 2019
excuse me....but I'm no sure ...is it true pas2js already has anonymous
method support ?
Thank a lot!
El lun., 21 oct. 2019 a las 22:22, warleyalex via Pas2js (<
pas2js at lists.freepascal.org>) escribió:
> generic function Min<T>(const A, B: T): T;
> begin
> if A < B then
> Result := A else
> Result := B;
> end;
>
> begin
> // it compiles/worked as expected
> specialize Min<Integer>(1, 0); // Min (1, 0): 0
> specialize Min<Single>(3.14, 5); //Min (3.14, 5): 3.14
> specialize Min<string>('a', 'b'); //Min ("a", "b"): a
>
> (* but we can not compile the following: *)
>
> WriteLn('Min (1, 0): ', specialize Min<Integer>(1, 0));
> WriteLn('Min (3.14, 5): ', specialize Min<Single>(3.14, 5));
> WriteLn('Min (''a'', ''b''): ', specialize Min<string>('a', 'b'));
> end;
>
> projGenericsA.lpr(29,41) Error: not yet implemented:
> TInlineSpecializeExpr:TInlineSpecializeExpr [20170306102158]
>
>
>
> --
> Sent from: http://pas2js.38893.n8.nabble.com/
> _______________________________________________
> Pas2js maillist - Pas2js at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js
>
--
MSc. Ing. Pedro Pablo Oviedo Vera
Dirección Técnica y Desarrollo
Empresa de Proyectos e Ingeniería del
Ministerio de la Agricultura.ENPA.
Boyeros y Conill, Piso 10 Edif MINAG
Telef. 884 7197
SIP:23000116
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20191022/28d3a14e/attachment.html>
More information about the Pas2js
mailing list