Case Range Statement ..

Jesse Phillips jessekphillips at gmail.com
Mon Jul 6 23:22:31 PDT 2009


On Tue, 07 Jul 2009 17:56:31 +1200, Tim Matthews wrote:

I want to try and using similar terminology to show that 'static' is used 
with the same principle.

> static import bar;   //must use fully qualified name 

The module "owns" the members (functions, globals). Since the owner is 
the module you must ask the module for its use.

> static int i;    //persistent across calls 

The function "owns" the variable. Rather than having each call to a 
function have the int i, all calls use the same one since the function 
owns it and not the call.

> static void foo() {} //member of class rather than instance

The class "owns" the function. Much like the previous one, the class 
instance doesn't own it, the class does, so all instances share the same 
thing.

> have you considered a syntax that is radically different from case
> FirstExp : .. case LastExp : like many of the posts in announce have
> suggested

I do believe they have, and do agree the syntax is a little... odd... but 
I think the alternatives have been turned down for good reason.

>  case FirstExp .. case LastExp :

Is nice, but I don't think removing the : really adds much, besides, 
Daniel Keep's shown form of writing it looks better with the : and 
ultimately better than the above form.



More information about the Digitalmars-d mailing list