www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10662] New: byLine!(Char, immutable Char) won't compile in git master

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10662

           Summary: byLine!(Char, immutable Char) won't compile in git
                    master
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: ntrel-public yahoo.co.uk


--- Comment #0 from Nick Treleaven <ntrel-public yahoo.co.uk> 2013-07-17
04:59:51 PDT ---
This won't compile because readln(buf) now requires a mutable buf.

I have a fix ready to submit presently.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 17 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10662


Nick Treleaven <ntrel-public yahoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid


--- Comment #1 from Nick Treleaven <ntrel-public yahoo.co.uk> 2013-07-17
05:16:54 PDT ---
https://github.com/D-Programming-Language/phobos/pull/1418

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 17 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10662


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra gmail.com


--- Comment #2 from monarchdodra gmail.com 2013-07-17 05:51:14 PDT ---
I question whether or not this is a "rejects valid": byLine explicitly states
buffer re-use, so requesting a `ByLine!(immutable Char)` simply is not
possible.

That said, I *would* see this as an enhancement, to have a line reader that
always returns brand new buffers (in which case the line may or may not be
immutable).

EG: By ByDupLine ?

Either that, or we simply keep using
`byLine().map!"a.dup"`
and
`byLine().map!"a.idup"`

That said, a `byDupLine` *is* a bit more user friendly, and helps limit levels
of complexity in user code, as well as limits dependency on algorithm.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 17 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10662



--- Comment #3 from monarchdodra gmail.com 2013-07-17 08:22:26 PDT ---
(In reply to comment #2)
 I question whether or not this is a "rejects valid": byLine explicitly states
 buffer re-use, so requesting a `ByLine!(immutable Char)` simply is not
 possible.
 
 That said, I *would* see this as an enhancement, to have a line reader that
 always returns brand new buffers (in which case the line may or may not be
 immutable).
 
 EG: By ByDupLine ?
 
 Either that, or we simply keep using
 `byLine().map!"a.dup"`
 and
 `byLine().map!"a.idup"`
 
 That said, a `byDupLine` *is* a bit more user friendly, and helps limit levels
 of complexity in user code, as well as limits dependency on algorithm.
In defense of the "ByDupLine" argument, one *BIG* advantage it can provide is that it can guarantee a single dup per front. `byLine().map!"a.dup`, on the other hand will call dup on every call to front. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 17 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10662



--- Comment #4 from Nick Treleaven <ntrel-public yahoo.co.uk> 2013-07-17
09:48:23 PDT ---
(In reply to comment #2)
 I question whether or not this is a "rejects valid": byLine explicitly states
 buffer re-use, so requesting a `ByLine!(immutable Char)` simply is not
 possible.
Where does byLine state that? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 17 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10662



--- Comment #5 from monarchdodra gmail.com 2013-07-17 15:04:45 PDT ---
(In reply to comment #4)
 (In reply to comment #2)
 I question whether or not this is a "rejects valid": byLine explicitly states
 buffer re-use, so requesting a `ByLine!(immutable Char)` simply is not
 possible.
Where does byLine state that?
Hum... I guess it doesn't actually state it (my bad). But even if un-documented, it is the "de facto" behavior, and the subject of countless threads on the boards. If (*if*) we accept that ByLine is designed as a range wrapper to "readln(_front)", then we should take into account that readln *does* document buffer re-use... That's my take on it anyways. I think adding support for this adds little value (IMO), and can only be exploited with a hard to use syntax. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 17 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10662


Nick Treleaven <ntrel-public yahoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |


--- Comment #6 from Nick Treleaven <ntrel-public yahoo.co.uk> 2013-07-18
08:08:27 PDT ---
(In reply to comment #2)
 I question whether or not this is a "rejects valid"
I suppose it's arguable, so I've now removed the rejects-valid keyword. (I think it did work before the readln(buf) change though).
 That said, I *would* see this as an enhancement, to have a line reader that
 always returns brand new buffers (in which case the line may or may not be
 immutable).
I have some ideas about other solutions, I will post something to the NG next week. I can't see how fixing this bug would be undesirable, but I agree byLine!(char, immutable char) is awkward syntax (I have an idea how to improve it). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 18 2013