Do you have a good reason for wanting this behaviour? If you have a system that is passing class handles throughout a system, and null is a valid state for a handle, you want to be able to propagate that null handle throughout that system. Since you have to dynamically check the handle for a subclass anyways, you should be able to deal with a null handle. Dave > -----Original Message----- > From: Arturo Salz [mailto:Arturo.Salz@synopsys.com] > Sent: Thursday, January 18, 2007 10:50 AM > To: Rich, Dave; William Paulsen; Arturo Salz; sv-ec@eda-stds.org > Subject: RE: [sv-ec] A question about copy constructors > > I don't agree. Attempting to copy a null object should result in an > error. Likewise, the idiom "p3 = new null;" ought to be a compiler > error. > > Arturo > > -----Original Message----- > From: Rich, Dave [mailto:Dave_Rich@mentor.com] > Sent: Thursday, January 18, 2007 9:14 AM > To: William Paulsen; Arturo Salz; sv-ec@eda-stds.org > Subject: RE: [sv-ec] A question about copy constructors > > I believe a copy of null is null, especially since we have established > the dynamic nature of the object being copied. > > If the BNF allows a shallow copy of an explicit null handle, then let it > be. > > Dave > > > > -----Original Message----- > > From: William Paulsen [mailto:paulsen@cadence.com] > > Sent: Thursday, January 18, 2007 6:29 AM > > To: Arturo Salz; Rich, Dave; sv-ec@eda-stds.org > > Subject: RE: [sv-ec] A question about copy constructors > > > > Thanks Dave, Arturo & Francoise for the comments, > > > > And here's another related question: What should happen if the source > > object in the copy ctor is null? > > > > module m; > > class c; > > endclass > > > > c p1 = null; > > c p2 = new p1; // What happens: error, p2 == null, something > > else? > > c p3 = new null; // Is this legal syntax? What does it do? > > endmodule > > > > > > Thanks, > > Bill > > > > > > > > -----Original Message----- > > From: Arturo Salz [mailto:Arturo.Salz@synopsys.com] > > Sent: Wednesday, January 17, 2007 7:06 PM > > To: Rich, Dave; William Paulsen; Arturo Salz; sv-ec@eda-stds.org > > Subject: RE: [sv-ec] A question about copy constructors > > > > Dave, > > > > I believe that the language of 1382 does indeed designate the dynamic > > type. This is because it refers to the type of the *object* being > > copied, not the type of the *handle* that refers the object being > > copied. This could be clarified with a minor friendly enhancement to > > 1382, possibly as a separate mantis item. > > > > Arturo > > > > -----Original Message----- > > From: Rich, Dave [mailto:Dave_Rich@mentor.com] > > Sent: Wednesday, January 17, 2007 3:42 PM > > To: William Paulsen; Arturo Salz; sv-ec@eda-stds.org > > Subject: RE: [sv-ec] A question about copy constructors > > > > Bill, > > > > I can only speak for the people here at Mentor; yes we agree that the > > dynamic class type is what is best. > > > > Since 1382 has already passed in the WG and is being edited into the > > upcoming draft, the most efficient thing to do is to open up a new > > mantis item. > > > > Dave > > > > > > > -----Original Message----- > > > From: William Paulsen [mailto:paulsen@cadence.com] > > > Sent: Wednesday, January 17, 2007 3:22 PM > > > To: Arturo Salz; Rich, Dave; sv-ec@eda-stds.org > > > Subject: RE: [sv-ec] A question about copy constructors > > > > > > Dave Rich: > > > > > > Do people agree with Arturo about the type of "p1" in the example > > below? > > > (This is different from the first email comments I received.) > > > > > > > > > And can 1382 be reopened, so that the errata can be modified? Item > 1 > > in > > > the new paragraph would now be: > > > > > > "1. An object of the >>> dynamic <<< class type being copied is > > > allocated. This allocation shall not call the object's constructor > or > > > execute any variable declaration initialization assignments. > > > > > > > > > Thanks, > > > Bill > > > > > > > > > -----Original Message----- > > > From: Arturo Salz [mailto:Arturo.Salz@synopsys.com] > > > Sent: Tuesday, January 16, 2007 8:10 PM > > > To: William Paulsen; Rich, Dave; sv-ec@eda-stds.org > > > Subject: RE: [sv-ec] A question about copy constructors > > > > > > Bill, > > > > > > I agree that the LRM needs to clarify this point. > > > > > > The only type that I think makes sense is the dynamic type (c3 in > your > > > > > example). > > > > > > Arturo > > > > > > -----Original Message----- > > > From: William Paulsen [mailto:paulsen@cadence.com] > > > Sent: Tuesday, January 16, 2007 2:51 PM > > > To: Arturo Salz; Rich, Dave; sv-ec@eda-stds.org > > > Subject: RE: [sv-ec] A question about copy constructors > > > > > > > > > But the errata for mantis 1382 seems ambiguous. The first sentence > of > > > > > item 1 of the new paragraph says for shallow copy: > > > > > > "An object of the class type being copied is allocated." > > > > > > > > > Is this the static type? Or the dynamic type? > > > > > > In my example below, the static type of p2 is "class c2", but the > > > dynamic type is "class c3": > > > > > > c1 p1 = new p2; // what is the type of the object: c1, c2, or > > c3? > > > > > > > > > I think the errata should be explicit about the type (static or > > > dynamic). > > > > > > > > > Thanks, > > > Bill > > > > > > > > > Here's the mantis 1832 errata: > > > > > > http://www.eda.org/svdb/file_download.php?file_id=1500&type=bug > > > > > > > > > > > > -----Original Message----- > > > From: Arturo Salz [mailto:Arturo.Salz@synopsys.com] > > > Sent: Tuesday, January 16, 2007 3:38 PM > > > To: Rich, Dave; William Paulsen; sv-ec@eda-stds.org > > > Subject: RE: [sv-ec] A question about copy constructors > > > > > > Oops. I take that back. I just went and re-read the proposal. > > > > > > Dave is right. The constructor new p2 creates an object of type c2 > and > > > > > the handle to the new object is assigned to p1. > > > > > > Sorry for the confusion. > > > > > > Arturo > > > > > > -----Original Message----- > > > From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of > > > Arturo Salz > > > Sent: Tuesday, January 16, 2007 12:28 PM > > > To: Rich, Dave; William Paulsen; sv-ec@eda-stds.org > > > Subject: RE: [sv-ec] A question about copy constructors > > > > > > That is not what mantis 1382 was about. > > > > > > In the example p1 is of type c1 (the base class). I believe the > > question > > > is whether the shallow copy performs an auto-cast from p2 to p1 in > > this > > > case. I believe the answer is yes. > > > > > > Arturo > > > > > > -----Original Message----- > > > From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of > > > Rich, Dave > > > Sent: Tuesday, January 16, 2007 11:44 AM > > > To: William Paulsen; sv-ec@eda-stds.org > > > Subject: RE: [sv-ec] A question about copy constructors > > > > > > This was mantis 0001382 which was approved in September. > > > > > > p1 will be point to an object of type c2. > > > > > > Dave > > > > > > > > > > -----Original Message----- > > > > From: owner-sv-ec@server.eda.org > [mailto:owner-sv-ec@server.eda.org] > > > On > > > > Behalf Of William Paulsen > > > > Sent: Tuesday, January 16, 2007 11:31 AM > > > > To: sv-ec@server.eda-stds.org > > > > Subject: [sv-ec] A question about copy constructors > > > > > > > > Hi, > > > > > > > > The LRM does not seem to be clear about the last statement in the > > > > example below. Can someone clarify this? > > > > > > > > Thanks, > > > > Bill Paulsen > > > > > > > > > > > > > > > > module m; > > > > class c1 > > > > endclass > > > > > > > > class c2 extends c1; > > > > endclass > > > > > > > > class c3 extends c2; > > > > endclass > > > > > > > > c3 p3 = new; > > > > c2 p2 = p3; > > > > c1 p1 = new p2; // what is the type of the object: c1, c2, or > > c3? > > > > endmodule > > > > > > > > > > > > -- > > > > This message has been scanned for viruses and dangerous content by > > > > MailScanner, and is believed to be clean. > > > > > > > > > > > > > -- > > > This message has been scanned for viruses and dangerous content by > > > MailScanner, and is believed to be clean. > > > > > > > > > > > > -- > > > This message has been scanned for viruses and dangerous content by > > > MailScanner, and is believed to be clean. > > > -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Thu Jan 18 11:05:11 2007
This archive was generated by hypermail 2.1.8 : Thu Jan 18 2007 - 11:05:18 PST