[Pas2js] Possible feature? keep the original JS overload behavior
Michael Van Canneyt
michael at freepascal.org
Fri Dec 21 22:50:01 CET 2018
On Fri, 21 Dec 2018, Mattias Gaertner via Pas2js wrote:
> On Fri, 21 Dec 2018 20:17:04 +0100 (CET)
> Michael Van Canneyt <michael at freepascal.org> wrote:
>
>> On Fri, 21 Dec 2018, silvioprog wrote:
>>
>> > On Fri, Dec 21, 2018 at 3:08 PM Michael Van Canneyt
>> > <michael at freepascal.org> wrote:
>> >
>> >> I think that should be possible, but only for external functions.
>> >>
>> >> Michael.
>> >
>> >
>> > sorry, but it sounds very strange for me:
>>
>> I meant, what you propose (omitting optional args) should be possible
>> for external functions.
>
> Why forbid it for Pascal functions?
Because the actual call then matches the declaration, it just has some values
pre-filled in. Defaults are just a way to save typing, after all.
What happens under the hood should IMO always be the same:
When a function expects 5 arguments, it should get 5.
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 :-)
Michael.
More information about the Pas2js
mailing list