Re: [sv-bc] 12.4.5 Optional argument list - question

From: Steven Sharp <sharp_at_.....>
Date: Tue Apr 18 2006 - 11:25:17 PDT
>From: "Bresticker, Shalom" <shalom.bresticker@intel.com>

>12.4.5 says,
>
>"When a void function or class function method specifies no arguments,
>the empty parenthesis, (), following the subroutine name shall be
>optional. This is also true for tasks, void functions, and class methods
>that require arguments, when all arguments have defaults specified. It
>shall be illegal to omit the parenthesis in a directly recursive nonvoid
>function method call that is not hierarchically qualified."
>
>This is unclear about nonvoid functions.

The intent of this text was to require the empty parentheses for normal
function calls.  They can only be omitted in the 2 cases specified:
void functions, and class function methods.


>The first two sentences specify when parentheses (not 'parenthesis') may
>be omitted. Both apply to void functions only. This implies that nonvoid
>function calls may never omit the parentheses. 

Void functions, and void or non-void class function methods.  The
sentence should be read as "(void function) or (class function method)",
not as "void (function or class function method)".  If the latter had
been meant, it would have just said "void function", because a class
function method is a function.  It might have been clearer if it had
said "void function or class method function", but perhaps that is
wrong terminology.

Personally, I wanted to require parens in the case of non-void class
function methods too.  However, the intent of the approved text was
to allow them to be omitted, even though that might not be clear from
the wording.

>The last sentence says that parentheses may not be omitted in a nonvoid
>function call in a corner case. This implies that they may be omitted in
>all other cases.

Look at it again.  It says that they may not be omitted in a non-void
function *method* call in a corner case.  And as you say, this implies
that they may be omitted in non-void function method calls in other
cases.  That is the same thing that the earlier statement already said
explicitly (though perhaps not clearly enough).

This particular corner case is to get around the fact that a function
name used inside the function itself is a reference to the function
return variable, so it cannot be a directly recursive function call.

The need for these convoluted rules and exceptions should be a clear
indicator that trying to omit the parens was just a bad idea.

Steven Sharp
sharp@cadence.com
Received on Tue Apr 18 11:25:21 2006

This archive was generated by hypermail 2.1.8 : Tue Apr 18 2006 - 11:25:33 PDT