Today's programming challenge - How's your Range-Fu ?

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 17 12:07:07 PDT 2015


On 4/17/2015 11:46 AM, H. S. Teoh via Digitalmars-d wrote:
> On Fri, Apr 17, 2015 at 11:44:52AM -0700, Walter Bright via Digitalmars-d wrote:
>> On 4/17/2015 11:17 AM, H. S. Teoh via Digitalmars-d wrote:
>>> Well, talk is cheap, so here's a working implementation of the
>>> non-Unicode-correct line wrapper that uses ranges and does not
>>> allocate:
>>
>> awesome! Please make a pull request for this so you get proper credit!
>
> Doesn't that mean I have to add the autodecoding workarounds first?

Before it gets pulled, yes, meaning that the element type of front() should 
match the element encoding type of Range.

There's also an issue with firstindent and indent being the same range type as 
'range', which is not practical as Range is likely a voldemort type. I suggest 
making them simply of type 'string'. I don't see any point to make them ranges.

A unit test with an input range is needed, and one with some multibyte unicode 
encodings.



More information about the Digitalmars-d mailing list