On 12/19/10, fernando trasvina <trasv...@gmail.com> wrote:
>
> On Dec 19, 2010, at 2:17 AM, Garrett Smith wrote:
>
>> On 12/18/10, Juriy Zaytsev <kan...@gmail.com> wrote:
>>> On Sun, Dec 19, 2010 at 2:02 AM, Garrett Smith
>>> <dhtmlkitc...@gmail.com>wrote:
>>>
>>>> On 12/18/10, Ezequiel <ezequ...@ziggyism.com> wrote:
>>>>> On Dec 17, 2:37 am, Juriy Zaytsev <kan...@gmail.com> wrote:
>>>>>> var beget = (function() {
>>>>>>  function F(){ };
>>>>>>  return function(o) {
>>>>>>    F.prototype = o;
>>>>>>    return new F;
>>>>>>  };
>>>>>>
>>>>>> })();
>>>>>>
>>>>>
>>>>>> return new F;
>>>>>
>>>>> Are there any penalties for not including the parentheses when you're
>>>>> invoking a constructor?
>>>>>
>>>>> ie. new F; versus new F();
>>>>>
>>>>
>>>> It is the `new` operator, not `Arguments`, that makes it a New
>>>> Expression.
>>>>
>>>> More is explained here (thread tip: ignore troll response):
>>>> <
>>>> https://groups.google.com/group/comp.lang.javascript/browse_thread/thread/6bb13a70aa769e17/ce53a37da77d354b#ce53a37da77d354b
>>>>>
>>>
>>>
>>> | Parenthesis is either `Arguments` or as Grouping Operator, depending on
>>> | the context in which it appears. When parenthesis appear to the right
>>> of
>>> | a MemeberExpression, then a CallExpression is formed. [...]
>>>
>>> ..or to the right of another CallExpression:
>>
>> Ah, that's right.
>
> parenthesis are for function calling not for arguments, arguments object is
> created either you passed arguments or no.

We are discussion the ECMAScript grammar productions known as
`Arguments`, `NewExpression`, `MemberExpression`, and
`CallExpression`. Did you follow the c.l.js thread URL I posted in my
message? Did you see kangax message about those?

Please also see the ECMA-262 specification. Ed 3 section on LHS
expressions linked here for convenience:
<http://bclary.com/2004/11/07/#a-11.2>

> the new operator is the one that triggers the object creation process, but
> for consistency i would recommend to put the parenthesis, because in the end
> the function will get called.

The new operator is what makes the NewExpression; right. It is
`Arguments` that is optional. What you are calling the "parenthesis"
is formally known as `Arguments`.

You seem to be referring to the sore spot known as the `arguments`
object, available in the function call. Am I right? An `arguments`
object is required to be created, though that is optimized in certain
situations by certain implementations (if a tree falls in the woods,
does it make a sound?). And there are a few c.l.js threads where we
discussed implementations that optimize away of the creation of
`arguments` object.

But anyway, the `arguments` object and the grammar production known as
`Arguments` are two totally different things. We're discussing the
latter here.
-- 
Garrett

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to