Method overloading is the same thing as you know from C. When I said
that, I was more trying to get to what your goal was in suggesting the
feature. Do you want to be able to split this function into two
optional pieces, or would it be always called with both parts? If the
former, then proposed overloading (not sure if it was accepted in es4)
would do the same thing, though your syntax might be nicer. If your
idea was just to gain clarity in the purpose of each arguments then
named arguments might fulfill the same thing.

I'm not sure I feel very compelled by the idea, and I'd prefer to have
overloading and named arguments, as they are well understood and
familiar to programmers from other languages. In any case, I am sure
it is far too late to make significant syntax changes at this point...

Peter


On Feb 1, 2008 6:39 PM, Mark Filipak <[EMAIL PROTECTED]> wrote:
> Hello Peter, and thanks for your reply.
>
> Peter Hall wrote:
> > Perhaps there wouldn't be backwards compatibility issues, but there
> > might be other problems. In particular, if such a function call were
> > split over 2 lines, I think there would be ambiguity due to semi-colon
> > insertion.
>
> Ah, I see. In other words this:
>
>   getFirstChildOfElement(Element)withTagName(tagName);
>
> could potentially be written thus:
>
>   getFirstChildOfElement
>   (
>   Element
>   )
>   withTagName
>   (
>   tagName
>   );
>
> (I hadn't thought of that... but I kinda like it! -- you've got to admit that 
> it has some eye appeal.)
>
> Certainly automatic semicolon insertion -- which I hate -- would want to 
> insert a semicolon after the first closing parenthesis. So the question 
> arises: How would the interpreter discriminate between a single, new-fangled 
> call and two successive calls to two different functions: 
> getFirstChildOfElement(Element) and withTagName(tagName). Well, that's a 
> problem, isn't it.
>
> I suppose that putting restrictions like no whitespace would dirty up the 
> language, so I guess it's not a good idea -- but you've got to admit that it 
> has a certain appeal, doesn't it? Ah well. Can't have everything in life.
>
> I'm afraid that I don't know what method overloading is. I do know function 
> overloading ala C, but not method overloading. Can you give me an example or 
> point me to an example?
>
> Regards,
> Mark
>
>
> > Also, I think the syntax only works when combined to a very specific
> > naming scheme, which might not make sense for a lot of functions. I
> > couldn't quite decipher your objective: would either (or both
> > together) of named arguments or method overloading do what you want?
> >
> > Peter
> >
> >
> >
> > On Feb 1, 2008 1:13 AM, Mark Filipak <[EMAIL PROTECTED]> wrote:
> >> Hello,
> >>
> >> (Sorry. What I meant to write is below.)
> >>
> >> May I make a pitch for an expanded function syntax? This example will
> >> say it all (I hope).
> >>
> >> What I have to write now:
> >>
> >>  getFirstChildOfElementWithTagName(Papa, 'baby');
> >>
> >> What I'd like to be able to write:
> >>
> >>  getFirstChildOfElement(Papa)withTagName('baby');
> >>
> >>  function getFirstChildOfElement(Papa)withTagName(babyTagName) {
> >>    alert(arguments[0].tagName);   // Show Papa's tag name
> >>    alert(arguments[1]);   // Show desired baby's tag name
> >>  }
> >>
> >> I don't think such an expanded capability would have any backward
> >> compatibility issues. It would make function calls more readable and
> >> easier to remember.
> >>
> >>
> >> Ciao -- Mark Filipak
> >>
> >>
> >> _______________________________________________
> >> Es4-discuss mailing list
> >> Es4-discuss@mozilla.org
> >> https://mail.mozilla.org/listinfo/es4-discuss
> >>
> >
>
_______________________________________________
Es4-discuss mailing list
Es4-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to