| Thread overview | |||||||
|---|---|---|---|---|---|---|---|
|
August 06, 2002 static const methods | ||||
|---|---|---|---|---|
| ||||
In C++, this was disallowed:
class Someting {
static void Method() const;
};
It should mean a static method which should not change any of the static
members.
As compared to the allowed:
class Someting {
void Method() const;
};
Meaning a non-static method, which should not change any of the members. Does / will D support static const methods?
Yours, Sandor
| ||||
August 07, 2002 Re: static const methods | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Sandor Hojtsy | In D, const is a storage class, not a modifier or attribute. It's not part of the type system. Sean "Sandor Hojtsy" <hojtsy@index.hu> wrote in message news:aio9j9$hjk$1@digitaldaemon.com... > In C++, this was disallowed: > > class Someting { > static void Method() const; > }; > > It should mean a static method which should not change any of the static > members. > As compared to the allowed: > > class Someting { > void Method() const; > }; > > Meaning a non-static method, which should not change any of the members. Does / will D support static const methods? > > Yours, Sandor | |||
August 08, 2002 Re: static const methods | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Sean L. Palmer | "Sean L. Palmer" <seanpalmer@earthlink.net> wrote in message news:aiql5v$13cs$1@digitaldaemon.com... > In D, const is a storage class, not a modifier or attribute. It's not part of the type system. Right. The const thing in C/C++ is a good idea, it just never worked out well in practice. | |||
August 21, 2002 Re: static const methods | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:aisdjh$23t3$1@digitaldaemon.com... > > "Sean L. Palmer" <seanpalmer@earthlink.net> wrote in message news:aiql5v$13cs$1@digitaldaemon.com... > > In D, const is a storage class, not a modifier or attribute. It's not part of the type system. > > Right. The const thing in C/C++ is a good idea, it just never worked out well in practice. > There is no need to call this property "const", if it bothers you. class Someting { void restricted Method(); }; Such a method should be unable to change any member values. I found such restrictions usefull. | |||
August 23, 2002 Re: static const methods | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Sandor Hojtsy | "Sandor Hojtsy" <hojtsy@index.hu> wrote in message news:ajvpgs$g7i$1@digitaldaemon.com... > There is no need to call this property "const", if it bothers you. > > class Someting { > void restricted Method(); > }; > > Such a method should be unable to change any member values. I found such restrictions usefull. Dealing with const/volatile attributes permeates the C++ spec, and causes a great deal of complexity and implementation grief. The benefit isn't there for the added complexity. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply