Re: [sv-ec] sub-class constructor

From: Steven Sharp <sharp_at_.....>
Date: Thu Feb 12 2009 - 10:46:12 PST
>From: jonathan.bromley@doulos.com

>Would it be legal to call a function to compute
>the arguments? (Evidently, not a *member* function.)
>
>In all such cases, super.new() is not the first
>executable code in D::new() even if it is
>lexically the first code to appear.

Yes, I recall this being discussed.  There are some other such cases.
Initializers for local variables inside new() would be executed on
entry to the scope, which is before the first statement.  You can't
defer that until after the call to super.new(), since those variables
could be used as arguments to super.new().  I.e.

  function D::new(bit b);
    int i = b ? -1 : 1;
    super.new(i);
    
Default argument values for new() might also be such a case, depending
on what exact scope you think they are executed in.    
    
Dave Rich and I agreed that it might be best if explicit or implicit
references to 'this' were not allowed until after super.new() was called.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Feb 12 10:48:15 2009

This archive was generated by hypermail 2.1.8 : Thu Feb 12 2009 - 10:48:35 PST