D - Attributes
- Sean L. Palmer (21/21) Aug 20 2003 I've been thinking about the const situation again and I think these are
I've been thinking about the const situation again and I think these are
groups of unrelated concepts:
public, private, protected: control visibility (if it's not visible,
it's not even an rvalue)
const, mutable, non-const: control assignability (rvalue vs. lvalue)
volatile, non-volatile: compiler should not make assumptions about it;
things are happening outside of its knowledge
ref, non-ref: control creation of new instances vs. simple restricted
"pointers" to instances
user-defined attributes: apply custom code, or can help influence
overloading and interface selection.
they can work on data, or on member functions. ref and non-ref do not apply
to member functions, only data such as parameters.
You need a few kinds of attributes:
groups of mutually exclusive attributes, only one can apply at a time.
solitary attributes, which default to off and you can switch on or off.
Need a way to turn them off!! "!const"?
Maybe "const" should be the default for parameters? That might prevent so
much mandatory use of const. But then you'd definitely need a way to turn
it off, for inout / out ref parameters.
Sean
Aug 20 2003








"Sean L. Palmer" <palmer.sean verizon.net>