Hi Michael, We discussed your request in today's sv-ec meeting. A new mantis item (errata) will be created and a normative text will be added. It will need to be voted on at the next meeting, April 24th, 2006. Regards, - Mehdi -----Original Message----- From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of Michael Burns Sent: Wednesday, April 05, 2006 7:40 AM To: Rich, Dave Cc: sv-ec@eda.org Subject: Re: [sv-ec] "this" as default argument Hi folks, Having this sorted out would be useful to us - is anyone willing to take a look at this and compose an erratum? Thanks, Mike Rich, Dave wrote: > I believe the answer to your question has to be yes, but the LRM does > not support that answer. 'this' is not defined in the scope containing > the declaration of the method. That rule was created to keep you from > doing things like: > > function void foo(int A=x, int B=A); > int x = bar(); > endfunction > > The rules for determining the order of evaluation would be too complex > at the very least. However, if you have: > > class A; > > int x; > function void foo(int x=x); > ... > endfunction > > It's semantically clear that the x on the RHS refers to this.x, > regardless of what identifier is on the LHS because the RHS is > evaluated in the context of the scope containing the declaration of > foo, not inside of foo. > > There is an erratum somewhere here. > > > Dave > > > >>-----Original Message----- >>From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of >>Michael Burns >>Sent: Thursday, March 30, 2006 3:53 PM >>To: sv-ec@eda.org >>Subject: [sv-ec] "this" as default argument >> >> >>Hi folks, >> >>Is it the intent of the committee that "this" should be a valid > > default > >>argument value for class methods? For example, >> >>class Foo; >>... >> >> task mytask(Foo f = this); >> ... >> endtask >>endclass >> >>The 1800 standard seems to suggest this (12.4.3, "The default_value is >>an expression. The expression is evaluated in the scope containing the >>subroutine declaration each time a call using the default is made"), > > but > >>section 7.10 makes it a little less clear ("The this keyword shall > > only > >>be used within nonstatic class methods") - does use as a default value >>in the method's arg list count as being "within" the method? >> >>--Mike Burns >>Freescale SemiconductorReceived on Mon Apr 10 13:10:45 2006
This archive was generated by hypermail 2.1.8 : Mon Apr 10 2006 - 13:10:57 PDT