Change some keywords and enum manifests?

Adam D. Ruppe destructionator at gmail.com
Tue Apr 27 10:39:23 PDT 2010


On Tue, Apr 27, 2010 at 01:12:13PM -0400, bearophile wrote:
> The situation of the 'static' keyword is silly.

Static isn't bad - it always means the same thing: "this won't change
across instances."

class A {
	static void f(); // f does the same across all instances of A
	static int a; // same variable across all instances of A
}

void f() {
	static int a; // same across all calls of function f()
}

The compile time ones also apply in the same way, if you think of the
program as being like a class, and instances of the program at runtime as
being objects.

static if(a) { } // doesn't change across instances of the program
static assert(a) // same as static if


The only place I can think of where it doesn't fit perfectly is static
import, and even then it fits loosely: calls to that module will always
be the same (fully qualified).


I'm ok with keyword reuse when it all fits under one main definition, which
static does. If you are giving multiple definitions to one word though, that's
less ideal.

enum works fine by me too by the way: it is any compile time value, which
also applies to manifest constants.

-- 
Adam D. Ruppe
http://arsdnet.net



More information about the Digitalmars-d mailing list