Testing for template argument being result of takeExactly

Jonathan M Davis jmdavisProg at gmx.com
Sun Sep 23 15:01:36 PDT 2012


On Sunday, September 23, 2012 13:55:04 Philippe Sigaud wrote:
> Transforming it into a predicate template is easy, I just wanted to
> show that R._input is accessible.

I was trying to test it without checking its internals (which should be 
possible IMHO), but if I have to check its internals, I have to check its 
internals. Actually, it hadn't occured to me to check its internals, but I 
would have wanted to avoid it (and still do), but this will work for now. 
Thanks.

> Caution: takeExactly returns a slice when the range is slice-able. You
> should test for hasSlicing on R first.

Actually, I'm messing with hasSlicing, so I have to be _very_ careful here. 
Per a discussion on github, I'm changing it to require that the return type of 
opSlice for finite ranges returns a type which can be assigned to the original 
type and that for infinite ranges it be the result of takeExactly. The changes 
to opSlice themselves seem straightforward enough but the side effects on take 
and takeExactly have gotten a bit hairy, since they reference hasSlicing. I 
don't think that it'll take many changes, but getting it right has been hard.

> As for Voldemort (Nameless One, Dark Lord, whatever) types, I find
> them more annoying than useful, personally.

Due to how they affect the init property and some other stuff, they may have to 
be axed (there's a bug report discussing some of those issues somewhere, but I 
don't remember it's number), but we still have them for the moment. The idea 
is cool, but the ultimate result is definitely problematic.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list