On Thursday, 15 February 2018 at 22:49:56 UTC, Alex wrote:
Hi all,
a short question about an old bug:
https://issues.dlang.org/show_bug.cgi?id=11877

Are there reasons, which speaks against this feature?

And maybe another one, more general:
Is there any place, where it is documented, which operators can work in static mode and which cannot?

There's a hack to make static slicing working actually.
I've used it once to make a kind of set of character. Reduced example:


```
struct Foo
{
    static auto opSlice(int index)(size_t lo, size_t hi)
    if (index == 0)
    {
        return 42;
    }
    static auto opIndex(A...)(A a)
    {
        return 42;
    }
}

static assert(Foo[0..1337] == 42);
```

I don't know if it is possible by error, maybe they forgot to disable this form of slicing.

Reply via email to