seeding the pot for 2.0 features

BCS ao at pathlink.com
Tue Jan 23 13:49:17 PST 2007


Now that the big 1.0 is out, I think that we should start considering what 
to put into 2.0. I don't think we need to rush anything into D yet, but maybe 
we should start accumulating a list of things to consider.

One overall thought I had is that it seems the big killer for C++ was to 
some extent that it is a strict superset of C. Maybe we should avoid this 
problem and not requiter that D2.0 be backwards compatible at the source 
level, but only at the ABI level sort of like C and D are now. Anyway, just 
a thought. 

Here are a few of my ideas for 2.0.


1)  Modules structs and classes can have static this() functions, why functions? 
If a static nested constructor were allowed for functions, it would allow 
static function variable to be initialized at load time.



2)  Why is there no tupleof property for interfaces? It would allow for some 
intriguing possibilities.

interface I{...}

class C : I
{
	mixin ImpInterface!(I);
}

template ImpInterface(T)
{
	mixin ImpInterface_!(T.tupleof);

	private ImpInterface_(F, V...)
	{
		mixin Implement!(F)
		static if(V.length > 0
			mixin ImpInterface_!(V);
	}
}

3) promote static foreach to the same level as static if. This with #2 could 
be reel slick.

template ImpInterface(T)
{
	static foreach(F; T.tupleof);
	{
		F	// assumes that F is a function 
			// including name and everything
		{
			// implement F
		}
	}
}

4) I guess that also needs a "implementable function alias". The syntax, 
not to mention the name, could ues a little work, but I expect you get the 
picture.





More information about the Digitalmars-d mailing list