DMD 1.005 release

BCS BCS at pathlink.com
Wed Feb 7 10:52:59 PST 2007


Walter Bright wrote:
> 
> 
> The right way to do versions that cut across multiple files is to 
> abstract the versioning into an API, and implement the different 
> versions in different modules.
> 

What about cases where 90% of the code is identical but small bits and 
peaces are different? If I understand correctly, to do what you suggest 
would requirer that those bits be put in functions and have several 
versions of the function somewhere else. This could be a problem in 
several ways

===Tiny bits of code would requirer tiny functions that would hide what 
is going on.

version(RowMajor)
	x = table[i][j];
else // RowMinor
	x = table[j][i];

====Empty else cases would result in do nothing functions:

version(StrongChecks)
{
	if(foo) ...
	if(bar) ...
	...
}
//empty else

====You can't break across function calls

switch(i)
{
	case 1:
		version(Baz)
			if(baz) break;
		else
			break;
	case 2:

	...// lots of un versioned code
}

or

switch(i)
{
	version(Baz)
	{
		case 1:
			if(baz) break;
	}
	case 2:

	...// lots of un versioned code
	
	version(!Baz)
	{
		case 1:
	}
}


====lots of version combinations

version(Foo) i = foo(i);
version(Boo) i = boo(i);
version(Fig) i = fig(i);
version(Baz) i = baz(i);
version(Bar) i = bar(i);	//32 options???


Are these valid concerns? Am I misunderstanding what you said?



More information about the Digitalmars-d-announce mailing list