RE: [sv-ec] Section 11 - Classes


Subject: RE: [sv-ec] Section 11 - Classes
From: Kevin Cameron x3251 (Kevin.Cameron@nsc.com)
Date: Thu Feb 06 2003 - 17:36:43 PST


> From fhaque@cisco.com Thu Feb 6 17:12:56 2003
>
> Kevin,
> The feature you are mentioning is very interesting. But I don't know how
> often I would need to reference more than one level up in the hierarchy.
> Plus the "super" keyword is very intuitive. So I would counsel against
> changing that.
>
> -Faisal

I prefer C++'s "::" to "super" - it's intuitive enough if you use C++
already, offers more functionality and doesn't create a new keyword.

Note: you only need this functionality if a derived class has a member
that masks a base class member, and there is no guarantee that will only
happen when the base class is the immediate parent (the proposal only
allows one level of "super" so it has very limited usefullness), the only
advantage it has over "::" is that you don't need the base class name
(but I'm not sure that buys you much).

Kev.

>
>
> -----Original Message-----
> From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org]On Behalf Of Kevin
> Cameron x3251
> Sent: Thursday, February 06, 2003 4:58 PM
> To: sv-ec@eda.org; stefen@boyd.com
> Subject: Re: [sv-ec] Section 11 - Classes
>
>
> > From: "Stefen Boyd" <stefen@boyd.com>
> > Subject: [sv-ec] Section 11 - Classes
> >
> > Stu editorially noted that he didn't want global
> > keywords new, this or super. I would agree that
> > having these be new global keywords is a problem.
> > But in this case, unless the language experts can
> > provide a slick syntax that isn't confusing, I'm
> > inclined to want these keywords... so it seems
> > that we need to consider Stu's `compatibility
> > proposal if there isn't a friendly syntactical
> > way around this. I definitely don't want to go into
> > contortions.
> >
> > Stefen
>
> Is "super" from Java? - C++ doesn't have it, you just
> use the base class name with "::" e.g.:
>
> class foo {
> public:
> int data;
> };
>
> class bar : public foo {
> public:
> int data; // masks foo
> int foo_data() {return foo::data;}; // Gets foo value
> };
>
> It has the advantage over "super" that it will refer
> to any inherited class - not just the immediate parent -
> and it only introduces the operator "::" instead of a
> keyword.
>
> If we use "::" instead of "super", but someone is desperate
> for the exact functionality of "super" we could use:
>
> ^::
>
> Kev.
>
>
>
>



This archive was generated by hypermail 2b28 : Thu Feb 06 2003 - 17:37:44 PST