RE: [sv-ec] forward declaration of a parameterized classes

From: Mark Hartoog <Mark.Hartoog_at_.....>
Date: Mon Sep 10 2007 - 10:57:15 PDT
> I think that is crucial that the forward include the
> information that the forward type is a parameterized
> class type so that the intent and consistency of
> the code is clear.
> 
> 
> I would fully support extending the syntax of a forward
> typedef to permit the form that you tried:
>     typedef class b_c #(type T int);
> 
> That would be a simple and effective change that clearly
> expresses intent and consistency while permitting what
> you are trying to do.
> 
> I would not support allowing "typedef class b_c;" to be
> treated as a parameterized class.
> 
> 
> Gord.

Doesn't this defeat the whole purpose of the forward typedef?

What if I wanted to do:

   class a_c #(type T = int, T2 = b_c #(T));
     int a1;
     function void set (T2 b);
       b.b1 = 5;
     endfunction
   endclass

   class b_c #(type T = int, T2 = a_c #(T));
     int b1;
     function void set (T2 a)
       a.a1 = 4;
     endfunction
   endclass

How do I write the forward typedefs for this?

typedef class a_c #(type T = int, T2 = b_c #(T));
typedef class b_c #(type T = int, T2 = a_c #(T));

This still has a forward reference to type 'b_c' in it.

I think the only way forward typedefs can do what they
originally were designed to do, is to allow the class 
typedefs without the parameters.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Sep 10 10:57:51 2007

This archive was generated by hypermail 2.1.8 : Mon Sep 10 2007 - 10:58:06 PDT