disable all member function calls for rvalues?

Michel Fortin michel.fortin at michelf.com
Wed Dec 23 09:29:10 PST 2009


On 2009-12-23 09:15:18 -0500, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> I didn't think that's invalid. I was talking about the other example 
> that looked like a field assignment but did not assign to a field.
> 
> File does not have an unlink member but I get your point. As I said, 
> refusing to bind ref to rvalues disables a few valid uses. I am willing 
> to renounce those few uses.

Is this one of them?

	int[5] array = [1, 2, 3, 4, 5];
	array[1..3] = [0, 0];

Or, more likely returning a non-built-in range type is one of them:

	MyContainer container = [1, 2, 3, 4, 5];
	container[1..3] = [0, 0];

and you'll have to write it like this:

	MyContainer container = [1, 2, 3, 4, 5];
	MyRange range = container[1..3];
	range = [0, 0];

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list