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

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Mon Sep 10 2007 - 11:04:13 PDT
Mark, neither Don's example nor my agreement included
the defaults.  They aren't needed and in fact, I would
be fine with having just:
    typedef class T #();
to indicate that "T" is a forward to a parameterized class.

I don't think that it is a good idea to allow forwards
by just using the type name.

Gord.

Mark Hartoog wrote:
>> 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.
> 

-- 
--------------------------------------------------------------------
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 Mon Sep 10 11:04:33 2007

This archive was generated by hypermail 2.1.8 : Mon Sep 10 2007 - 11:04:47 PDT