[sv-ec] "this" and member resolution in inline constraints

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Tue Dec 18 2007 - 13:50:04 PST
In considering some of the wording for the 1858 (inline constraints
name resolution) issues, I would like to raise an additional
concern and/or need for clarification.

"randomize" is definitely a virtual method.  In the discussion,
we were talking about "this" as following the normal method
resolution rules for "this" references.  That does pose a
problem when everything is composed.

Consider this case:

           class C;
              rand int x;
           endclass
           class D extends C;
              rand bit[1:0] x;
           endclass
           D d = new;
           C c = d;

           initial c.randomize with { x > 0 && x < 10; };

My working assumption has always been that the resolution
of "x" is based on the static type of the object prefix,
but I think that the wording and discussion related to
"this" has at least muddied the waters if not compromised
that interpretation completely.

If I have:
          initial c.randomize with { this.x > 0 && this.x < 10; };
the meaning of "this" is now different.  We would have to interpret
"this" not as the formal of the virtual method "randomize"
but as "a reference to the portion of the object addressable
by the static type of c".

There are many, many issues with a dynamic interpretation
of "this" so I would not want to propose that we follow the
dynamic resolution path.  I believe that the statically typed
interpretation I have above is consistent with Arturo's
view.

Since "this" would not follow the normal semantics of a
virtual method, I think that this needs to be reexamined or
clarified as part of 1858.

If the more static view of name binding is followed, there
are still potential questions related to handling of
other virtual method references within a constraint and
the overall coherency of object assumptions in such cases.

Gord.
-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Dec 18 13:50:45 2007

This archive was generated by hypermail 2.1.8 : Tue Dec 18 2007 - 13:51:08 PST