Proposed New C++ Keywords

2016-03-11

"And, behold, I will deliver you up to the programmer tendency to build overelaborate castles of abstractions" ~ King James Programming

In this tradition, here are three more C++ keywords my brother Billy and I thought up:
  1. sacred: This is a new access specifier like private, protected, and public. A sacred member variable can be read from (as if it was public), but can only be changed by the class it is part of (as if it was private). This would be useful for e.g. array sizes.

  2. eternal: This is a new modifier like const and volatile. The value of an eternal variable is shared between all executions of the program in two ways:
    1. If the program is closed and reopened, the variable still has the value it had before. I assume that this is done by storing the value in the executable and updating it when the program closes.
    2. If more than one copy of the program is run at the same time, changing the value in one changes it in the other. This would be done using shared memory.
    I assume that eternal variables would always be stored in shared memory with a references count. When the last copy of the program closed, the value would be written back into the executable. This would be useful for storing user options, and allowing programs to continue execution where they left off after they were closed.

  3. forbidden: I am not sure if this is an access specifier or a modifier. In either case, a forbidden variable can never be accessed directly. However, it can still be changed indirectly, by e.g. commands to read a N bytes from a file. Forbidden variables would allow saved data in an old binary format to still be read, even if some of the original fields were not longer used.

Back to essays page
Back to home page