On Monday, 30 December 2013 at 04:55:41 UTC, Dicebot wrote:
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.

This almost looks like something that could work, but is explicitly disallowed by the compiler.

        struct Test
        {
                enum opSlice(size_t a, size_t b) = 42;
        }
        
        //Error: can only slice tuple types, not Test
        Test[1..2] t2;

Reply via email to