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

Vladimir Panteleev vladimir at thecybershadow.net
Sat Jun 22 21:08:20 PDT 2013


On Saturday, 22 June 2013 at 20:09:01 UTC, monarch_dodra wrote:
> #2: Extremelly bad compatibility with simple no 
> bidir/non-slicing ranges: There is no way to iterate over a 
> specific part of a range, and making a range out of what was 
> just iterated over. For example "Get the beggining of this 
> range until the first x": not possible without slicing.

Not sure if I understood the question correctly, but the way I 
understood it:

1) To iterate over a specific part of a non-random-access range, 
you can use `drop` in conjunction with `take` or `takeExactly`.

2) To get an existing foreach loop to emit a range, move its body 
to the predicate of `map`, and break conditions to the predicate 
of `until` / `countUntil`.

3) As I understand, "get the beggining of this range until the 
first x, without slicing" is what `until` (or `countUntil` + 
`take`) does.


More information about the Digitalmars-d mailing list