[Pas2js] Possible feature? keep the original JS overload behavior

silvioprog silvioprog at gmail.com
Tue Dec 25 18:15:59 CET 2018


On Tue, Dec 25, 2018, 05:51 Michael Van Canneyt <michael at freepascal.org
wrote:

>
>
> On Mon, 24 Dec 2018, silvioprog wrote:
>
> > On Mon, Dec 24, 2018 at 7:01 PM Mattias Gaertner via Pas2js <
> > pas2js at lists.freepascal.org> wrote:
> >
> >> On Fri, 21 Dec 2018 22:50:01 +0100 (CET)
> >> Michael Van Canneyt <michael at freepascal.org> wrote:
> >>
> >>> [...]
> >>>> Why forbid it for Pascal functions?
> >>> The purpose of pas2js is to allow pascal to run in the browser.
> >>> The purpose is not to make pascal behave like Javascript.
> >>> I want to bend Javascript, not bend pascal. So if we really must bend
> >>> pascal to accomodate interaction with external JS code,
> >>> I prefer it limited to that use case alone :-)
> >>
> >> Good point.
> >>
> >> In that case the default value is not needed and syntax could be:
> >>
> >> procedure f(w: jsvalue = JSOmitArg); external name 'f';
> >>
> >> where JSOmitArg is a special value that is omitted.
> >> Advantage: no need to adapt Delphi/Lazarus.
> >>
> >> Mattias
> >
> >
> > That would be great.
> >
> > Will it be compatible to other types? E.g:
> >
> > procedure f(w: Integer = JSOmitArg); overload; external name 'f';
> > procedure f(w: string = JSOmitArg); overload; external name 'f';
> >
> > In the example above only Integers and Strings are allowed in f().
> >
> > p.s: JSDefault could be an option too. :-) E.g:
> >
> > procedure f(w: JSValue = JSDefault); external ...
>
> I would then suggest to use "undefined"  ?
>
> procedure f(w: Integer = undefined); overload; external name 'f';
>
> it exists in javascript, the meaning is clear, I think.
>
> Michael.


A single word is great. In a poll I would check the"undefined" option. :-)

Merry Christmas / Feliz Natal! 🎅

--
Silvio Clecio

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20181225/981533c3/attachment.html>


More information about the Pas2js mailing list