[sv-bc] RE: [sv-ec] Discussion overview of SV name resolution

From: Steven Sharp <sharp_at_.....>
Date: Mon Jun 05 2006 - 15:08:21 PDT
My response got garbled also.  Here is a retry:


>From: "Ryan, Ray" <Ray_Ryan@mentor.com>

> Gord,
>Are function calls allowed in a dotted name ?
>For example (from mantis #1391) in 13.13.2 the example contains:
>	process::self.srandom(100);
>where 'self' is a function that returns a class handle.

I believe that example is illegal on several counts.

First, self.srandom does not mean a call to the function self, followed
by a member select of the return value.  It means a hierarchical reference
into the scope of the function body of self, looking for a name srandom
defined inside that scope.  Since there is no such name in that scope,
this would be an error.

You could presumably change the reference to self from a reference to
the scope self into a call of the function self by adding an argument
list, as in
  process::self().srandom(100);

But then you still run into the problem that a dot is not considered
an operator that can be applied to the result of an arbitrary expression,
such as a function call.  It is considered part of a "name".  The prefix
of the dot is quite restricted.

I believe you would have to break that statement into two parts, assigning
the result of self() to a class object, and then invoking srandom on that.

(Note that this is another flaw in Brad's argument for allowing the
empty parentheses to be left off of method function calls.  This is another
visible difference between the behavior of a member defined as a class
method versus a class property.  The "Uniform Access Principle" is already
invalidated.)

Steven Sharp
sharp@cadence.com
Received on Mon Jun 5 15:07:56 2006

This archive was generated by hypermail 2.1.8 : Mon Jun 05 2006 - 15:08:04 PDT