IDEA: Use Unix-style chmod values for const and invariant
Jesse Phillips
jessekphillips at gmail.com
Thu Nov 29 14:51:40 PST 2007
On Thu, 29 Nov 2007 10:32:56 -0700, Russell Lewis wrote:
> Ok, I was pondering, trying to figure out some sort of syntax which
> would allow us to communicate "const" and "invariant" in a way that's
> easy to learn & remember. Maybe we could learn from UNIX file
> permissions, where you can see both the owner's permissions to the file,
> and "other's" permissions. In that case, we have these comparisons:
>
> const: rw-r--r--
> invariant: r--r--r--
>
> Which leads me to this concept for alternative keywords:
>
> const: const_wr
> invariant: const_rr
>
> Sure, the first time that a C++ programmer sees this, he won't know
> exactly what it means, but it is (IMHO) easy to learn & remember.
Looking at this, I like the way it can be used to explain what they are,
but I don't like the suggestion for new syntax. In my opinion invariant
is a great keyword for what it does, don't ever change. But const like
others is very much not descriptive of its use. I would think the two
keywords should be,
readonly ## which since keywords aren't usually 2, ro?
invariant
I'm not saying a name change is needed but maybe it should be looked into?
More information about the Digitalmars-d
mailing list