D1 -> D2

Fawzi Mohamed fawzi at gmx.ch
Thu Nov 18 22:47:27 PST 2010


 From the discussion it seems that defining something like:

version(D_Version2){
	template Const(T){
		alias const(T) Const;
	}
	template Immutable(T){
		alias immutable(T) Immutable;
	}
	immutable(T) Idup(T)(T val){
		return val.idup;
	}
	alias const(char)[] cstring;
} else {
	template Const(T){
		alias T Const;
	}
	template Immutable(T){
		alias T Immutable;
	}
	T Idup(T)(T val){
		return val.dup;
	}
	alias char[] string;
	alias char[] cstring;
}

could help a lot
later one can simply replace Const! with const and Immutable! with  
immutable, Idup replacement is more complicated, but doable
What is not so clear is how to cope with scope, because I have lot of  
delegates around that will need it.
For it a preprocessing step might really be the best thing, or someone  
knows a smart way to cope with that?


More information about the Digitalmars-d mailing list