RE: [sv-ec] Mantis 1857 - extern method types for parameterized classes

From: Mark Hartoog <Mark.Hartoog_at_.....>
Date: Wed Jun 20 2007 - 17:12:15 PDT
Obviously I should stop trying to reply to mails while rushing
to a meeting, since I did not make myself clear at all.

We have been discussing adding new and thus irregular syntaxes
to support this case. What I am trying to suggest is why not
also consider an irregular interpretation of existing syntax.
In:

function C::T C::get();

We are already interpreting the C::get() to refer to the 
unspecialized class. Why not also consider the C::T to refer
to T in the unspecialized class in the case when the function
and the type both refer to the same class.  

This is a rather irregular interpretation. In

function C::T get();

the same type refers to the type in the class with default parameters. 
This irregular interoperation would only apply to this case of extern 
method declaration and when the type class and method class were the
same. 

Our choices here seem to be either an irregular interpretation of syntax

or some new, irregular syntax that is only used here.

If the user really wanted an extern function with a return type of
the default value of the class type parameter, they could just use
the default type, rather than trying to reference it, or they
could do something like 'C#()::T' in this case. 


> -----Original Message-----
> From: Gordon Vreugdenhil [mailto:gordonv@model.com] 
> Mark Hartoog wrote:
> > While we are discussing other alternatives, why don't we consider:
> > 
> > function C::T C::get();
> > 
> > This has 'C::' twice, but it seems to be more consistent 
> with syntax 
> > in the rest of SV. Clearly references like 'C::T' could only be 
> > allowed in out of body function declarations because they would not 
> > make sense anyplace else.
> 
> Sure they do.
> 
>     C::T  foo;
>     function C::T my_function(); ... endfunction;
> 
> Both would use the "T" from the default specialization of C 
> as the type.
> 
> The second is exactly the situation I posted originally -- 
> when you parse C::T you don't know if you are referring to 
> "T" in the default specialization of C or whether you are 
> referring to the unspecialized name "T" in the parameterized 
> class for an extern method definition.
> 
> And, as I also posted previously, you could require C#()::T 
> in such situations but that would be irregular with the 
> semantics of a reference to "C" in other type contexts.
> 
> 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 Wed Jun 20 17:12:36 2007

This archive was generated by hypermail 2.1.8 : Wed Jun 20 2007 - 17:13:17 PDT