RE: [sv-ec] sub-class constructor

From: <jonathan.bromley_at_.....>
Date: Thu Feb 12 2009 - 15:11:49 PST
Tom,

> The Doulos statement means that if EtherPacket has a user-defined 
> new(), then it still requires "super.new(5)" (or just "super.new"?)

I think it's clear that, even on the most charitable reading,
that part of our Guide is poorly worded; and in any case it
certainly has no formal authority.  I accept that it needs
rephrasing and I've already said I will set that in motion.

However, the LRM's discussion isn't perfect either; the line

  class EtherPacket extends Packet(5);

appears to be illegal given the earlier examples, none of which
seems to have a Packet class whose constructor can accept 
a single integer argument by position.  This (admittedly minor)
confusion seems to have been preserved in the latest ballot draft.

It seems to me that users will be well advised to err on the
side of conservatism: in particular...
  - avoiding any call to a virtual method of a class
    from its constructor;
  - avoiding any use at all of class members or methods,
    other than statics, in the arguments to super.new().
But it's good to see consensus that it's OK to use expressions
to calculate the values of arguments to super.new().
-- 
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

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 Thu Feb 12 15:16:44 2009

This archive was generated by hypermail 2.1.8 : Thu Feb 12 2009 - 15:17:29 PST