Good name for f.byLine.map!(x => x.idup)?

sclytrack sclytrack at spring.com
Sun Mar 16 10:50:39 PDT 2014


On Sunday, 16 March 2014 at 17:28:46 UTC, Jakob Ovrum wrote:
> On Sunday, 16 March 2014 at 16:58:36 UTC, Andrei Alexandrescu 
> wrote:
>> A classic idiom for reading lines and keeping them is 
>> f.byLine.map!(x => x.idup) to get strings instead of the 
>> buffer etc.
>>
>> The current behavior trips new users on occasion, and the 
>> idiom solving it is very frequent. So what the heck - let's 
>> put that in a function, expose and document it nicely, and 
>> call it a day.
>>
>> A good name would help a lot. Let's paint that bikeshed!
>>
>>
>> Andrei
>
> Maybe `byUniqueLine`.
>
> We might also consider a higher order range (say, `byUnique`, 
> in the same vein) that GC-clones elements in some generic 
> fashion, then showing `f.byLine().byUnique()` front and centre 
> in `byLine`'s documentation.
>
> Just a couple of half-assed ideas to get the ball rolling.


   f.byLineIdup();





More information about the Digitalmars-d mailing list