Re: [sv-ec] RE: id 185, svdb 2342 static constructor

From: <jonathan.bromley_at_.....>
Date: Fri May 08 2009 - 01:33:41 PDT
[constructors]
> are not invoked using a handle because their invocation allocates
> the object that they use.  But regardless of how they are invoked, they
> are inherently not static.  Their purpose is to construct the object,
> which they cannot do without access to the object.

Agreed, but...

>  They have to be passed
> a 'this' handle (which is the handle for the allocated object) so that
> they can initialize the nonstatic members of the object.

I think there's another way of thinking about it that makes 
rather more sense to me.

When I call new() explicitly, I most certainly don't think of
it being passed "this" because "this" doesn't exist at the
time of the call.  Instead, imagine that the constructor
truly *is* static, but has "this" as an implicit local
variable that is implicitly used as a prefix to any mention
of class members within the body of new().

I'm very aware that this description is torturing the 
meaning of "this", but I still maintain that any call
to new() looks like a static method call; there is no
meaningful "this" at the time of the call, and so the
implicit "this" argument that is passed to non-static
methods can't happen.  And, indeed, this is perhaps
the root of some of the problems with super.new();
at the time of the call to super.new(), "super" has
already been allocated - making that call to new()
very different from a user's call to the base class's
constructor.

Whatever, we have to accept that new() is strange and
special, so we can make strange and special rules for it.
-- 
Jonathan Bromley
Consultant

Doulos - Developing Design Know-how
VHDL * Verilog * SystemVerilog * SystemC * PSL * 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                        http://www.doulos.com

--------------------------------------------------------------------------------
Doulos Ltd is registered in England and Wales with company no. 3723454
Its registered office is 4 Brackley Close, Bournemouth International 
Airport,
        Christchurch, BH23 6SE, UK. 

 This message may contain personal views which are not the views of
Doulos, unless specifically stated.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri May 8 01:35:48 2009

This archive was generated by hypermail 2.1.8 : Fri May 08 2009 - 01:38:47 PDT