March 17, 2014 Re: Good name for f.byLine.map!(x => x.idup)? | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On Monday, 17 March 2014 at 20:04:09 UTC, H. S. Teoh wrote:
> But what type would .explode() return? std.stdio.File.Explosion? :-P
std.stdio.File.Shrapnel, obviously.
--jjs
|
March 18, 2014 Re: Good name for f.byLine.map!(x => x.idup)? | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Stahara | On 2014-03-17 16:06, John Stahara wrote:
> On Monday, 17 March 2014 at 20:04:09 UTC, H. S. Teoh wrote:
>> But what type would .explode() return? std.stdio.File.Explosion? :-P
>
> std.stdio.File.Shrapnel, obviously.
>
> --jjs
ExplosionResult bomberMan = f.explode!(PewPew)
|
March 18, 2014 Re: Good name for f.byLine.map!(x => x.idup)? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Sun, 16 Mar 2014 16:58:38 -0000, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> 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! Why not simply "lines". foreach (line; file.lines) ... R -- Using Opera's revolutionary email client: http://www.opera.com/mail/ |
March 18, 2014 Re: Good name for f.byLine.map!(x => x.idup)? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Sun, 16 Mar 2014 12:58:38 -0400, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> 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! byImmutableLines byStringLines -Steve |
March 18, 2014 Re: Good name for f.byLine.map!(x => x.idup)? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Tuesday, 18 March 2014 at 13:49:45 UTC, Steven Schveighoffer wrote:
> On Sun, 16 Mar 2014 12:58:38 -0400, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> 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!
>
> byImmutableLines
> byStringLines
>
> -Steve
byPersistLines ?
|
March 18, 2014 Re: Good name for f.byLine.map!(x => x.idup)? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | On Tue, 18 Mar 2014 14:09:05 -0000, Dicebot <public@dicebot.lv> wrote: > On Tuesday, 18 March 2014 at 13:49:45 UTC, Steven Schveighoffer wrote: >> On Sun, 16 Mar 2014 12:58:38 -0400, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> 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! >> >> byImmutableLines >> byStringLines >> >> -Steve > > byPersistLines ? Why this fixation on "by"? lines allLines eachLine everyLine R -- Using Opera's revolutionary email client: http://www.opera.com/mail/ |
March 18, 2014 Re: Good name for f.byLine.map!(x => x.idup)? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Mon, 17 Mar 2014 12:38:23 -0000, bearophile <bearophileHUGS@lycos.com> wrote: > Dmitry Olshansky: > >> f.lines? > > There is already a lines in std.stdio (but I don't use it much), search for: > > foreach (string line; lines(stdin)) > > Here: > http://dlang.org/phobos/std_stdio.html Does this do the same as byLine or does it dup the lines? Can we replace or scrap it? foreach(string line; f.lines) is just too nice not to strive for, IMO. R -- Using Opera's revolutionary email client: http://www.opera.com/mail/ |
March 18, 2014 Re: Good name for f.byLine.map!(x => x.idup)? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Regan Heath | On Tuesday, 18 March 2014 at 14:57:30 UTC, Regan Heath wrote:
> Why this fixation on "by"?
>
> lines
> allLines
> eachLine
> everyLine
>
> R
range vs container. I expect file.lines to be separate fully allocated entity that can be assigned and stored. file.byLines implies iteration without any guarantees about collection as a whole.
|
March 18, 2014 Re: Good name for f.byLine.map!(x => x.idup)? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On 3/18/14, 6:49 AM, Steven Schveighoffer wrote:
> byStringLines
First one I like.
Andrei
|
March 19, 2014 Re: Good name for f.byLine.map!(x => x.idup)? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dicebot | On Tue, 18 Mar 2014 15:03:16 -0000, Dicebot <public@dicebot.lv> wrote: > On Tuesday, 18 March 2014 at 14:57:30 UTC, Regan Heath wrote: >> Why this fixation on "by"? >> >> lines >> allLines >> eachLine >> everyLine >> >> R > > range vs container. I expect file.lines to be separate fully allocated entity that can be assigned and stored. file.byLines implies iteration without any guarantees about collection as a whole. So "by" has come to signify "range" then? "eachLine" does not imply a container but an iteration/range.. R -- Using Opera's revolutionary email client: http://www.opera.com/mail/ |
Copyright © 1999-2021 by the D Language Foundation