What features of D are you using now which you thought you'd never goint to use?

Vladimir Panteleev vladimir at thecybershadow.net
Sun Jun 23 02:44:08 PDT 2013


On Sunday, 23 June 2013 at 09:10:03 UTC, monarch_dodra wrote:
> All of these will *iterate* over part of said range, but none 
> will actually return the subrange I iterated on.

`until` does not iterate, it simply returns a range which ends 
when your condition is satisfied.

>         V
> [ .  .  X  .  .  .  .  .  .  .  . ]
>
> I want:
> [ .  .  X ]

Isn't this what `until` does?

> countUntil + take can kind of mitigate the problem, but that 
> warps the type system: The type of take is not the type of the 
> range.

I believe wrapper ranges like `take` return ranges with the same 
capabilities as the ranges they wrap. This modularity design 
assumes that you will use the result in functions that accept 
ranges, i.e. templated functions that expect that the types of 
their parameters satisfy the is*Range constraints.

To avoid misunderstanding or miscommunication, could you post the 
practical problem you encountered, with context?


More information about the Digitalmars-d mailing list