[sv-ec] Static members of nested classes

From: Jonathan Bromley <jonathan.bromley_at_.....>
Date: Thu Sep 06 2007 - 01:05:37 PDT
hi SV-EC,

SV offers nested classes, although as far as I'm
aware no tools yet support them.  Consider:

  module M;

    class C;
      class D;  // nested class definition
        static int y;  // D::y
      endclass : D
      D d1 = new;
      D d2 = new;
    endclass: C

    initial begin : main
      C c1 = new;
      C c2 = new;
      c1.d1.y = 3;
      $display(c1.d2.y);  // obviously 3
      $display(c2.d1.y);  // 3 or 0 ???
    end

  endmodule: M

Now I have two instances of C, each "containing" a 
definition of D with its static D::y.  Is there in
fact just one, truly global, C::D::y?  Or is D::y in
each instance of C something more like a regular
data member of C, shared amongst all instances of
*that* D - something like c1.(D::y), if you like?

Syntax for the scope resolution operator admits
the form C::D::y, so I guess it's the former; 
I believe that C++ works this way, too.  However,
the LRM doesn't really help me reach a conclusion.
Is it worth adding something to the section covering 
nested classes (8.22) to clarify this?

Thanks
-- 
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223                   Email: jonathan.bromley@doulos.com
Fax: +44 (0)1425 471573                           Web: http://www.doulos.com

The contents of this message may contain personal views which 
are not the views of Doulos Ltd., unless specifically stated.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Sep 7 17:04:38 2007

This archive was generated by hypermail 2.1.8 : Fri Sep 07 2007 - 17:06:23 PDT