DIP54 : revamp of Phobos tuple types

Dicebot public at dicebot.lv
Sun Dec 29 20:55:40 PST 2013


On Monday, 30 December 2013 at 04:35:04 UTC, Timon Gehr wrote:
> Both. There is no precedent for rewriting operator arguments to 
> template value arguments neither in the spec, in newsgroup 
> discussions on the design of a potential feature, nor in the 
> implementation. You seemed to claim this is merely a compiler 
> bug and this can be deduced from the spec by analogy, so you 
> also appear to interpret rules wrong.

Ah I was referring to the fact that it does not seem to compile 
even assuming normal non-template parameters as indexes (which 
looks like a bug). Other part (which is real desired one) is not 
allowed by spec right now indeed.

struct X
{
	static int opSlice(size_t a, size_t b)
	{
		return 42;
	}
}

static assert ( X[1..2] == 42 );

// Error: cannot slice type 'X'

I expected this one to work.

>> Naive alias this implementation will be
>> sliceable. Problem is without this feature it will degenerate 
>> into raw
>> argument list upon slicing which is not clean but not fatal 
>> (still an
>> improvement over existing TypeTuple)
>
> Questionable. Slicing is a common operation

Sure and I am going to try it. But it is not a showstopper for 
DIP in question I think.


More information about the Digitalmars-d mailing list