RE: [sv-ec] Constant class methods

From: Rich, Dave <Dave_Rich_at_.....>
Date: Wed Apr 02 2008 - 07:09:20 PDT
Hold on there. SV does not have static classes. The implicit "this"
argument to a method of a class is just a handle to a dynamic object.
Making "this" a const just prevents you from modifying the handle; you
can still write to class properties.

> -----Original Message-----
> From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org]
On
> Behalf Of Mirek Forczek
> Sent: Wednesday, April 02, 2008 1:57 AM
> To: 'Steven Sharp'; sv-ec@server.eda.org; danielm@aldec.com.pl
> Subject: RE: [sv-ec] Constant class methods
> 
> Indeed, having 'const' attribute on method would result in treating
the
> implicit 'this' argument as constant one. That's what would happen
within
> scope of the method body.
> 
> But the 'const' attribute on method would have also impact on
semantics
> outside the method body:
> 
> - clearly denote the method's nature (documentation),
> - provide semantics to allow (const) method calls in special contexts
> (i.e.
> assertion formula),
> - provide input for compiler to enable potential code optimizations.
> 
> Regards,
> Mirek
> 
> -----Original Message-----
> From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org]
On
> Behalf Of Steven Sharp
> Sent: 2 kwietnia 2008 02:39
> To: sv-ec@server.eda.org; danielm@aldec.com.pl
> Subject: Re: [sv-ec] Constant class methods
> 
> 
> >From: "danielm" <danielm@aldec.com.pl>
> 
> >IMHO SV should itroduce constant modifier to class methods
(functions,
> >and task). This feature is widely used in other languages - ie in
C++.
> >Such modifier should forbid to modify class properties referenced.
> >It would be very usefull to know that certain function do not
modifies
> >the object on which it is called.
> 
> Is this equivalent to treating the implicit 'this' argument as const?
> 
> Steven Sharp
> sharp@cadence.com
> 
> 
> --
> 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 Wed Apr 2 07:10:47 2008

This archive was generated by hypermail 2.1.8 : Wed Apr 02 2008 - 07:11:30 PDT