Arturo Salz wrote: > -----Original Message----- > From: Gordon Vreugdenhil [mailto:gordonv@model.com] > Sent: Wednesday, November 21, 2007 11:39 AM > To: Arturo Salz > Cc: Neil.Korpusik@Sun.com; SV_EC List > Subject: Re: [sv-ec] Mantis 1584 - defaults for virtual methods > > > > The problem is what does "the same default" mean? > > > > For constant values this is meaningful. For non-constant > defaults, this becomes much more difficult to describe. > Particularly since there is an open question of whether > something like: > function void f(int x; int y = x;) > should be legal. > > IMHO what you wrote should not be legal, that is, bind a default argument to > a formal argument. The scope of default arguments is outside the function. > At least that’s how I interpret the LRM: > That is fine for now although Steven has suggested (and I agree) that this should be allowed in the future. But this isn't the only kind of non-constant expression. > 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. > > If so, then overrides in very useful scenarios becomes > exceedingly difficult to determine. > > > > So, I don't think that defining it to be "the same" is Ok. > > > > I don’t see what is the complication. The “same” means precisely that: > “the same”. That is > straightforward for constants (or literals). For variables or > expressions, it means the same > variables (or expressions) and bound to the same objects. But the base object might have defaults that are not visible to the derived class. That can happen with a parameterized class extending a type parameter for example. Such cases would become illegal if we adopt your suggestion. Given where the LRM will likely go and that "the same" requirement will make some code inexpressible and illegal, I think that option is not something that I'd support. Gord -- -------------------------------------------------------------------- Gordon Vreugdenhil 503-685-0808 Model Technology (Mentor Graphics) gordonv@model.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Mon Nov 26 07:09:53 2007
This archive was generated by hypermail 2.1.8 : Mon Nov 26 2007 - 07:10:34 PST