March 24, 2013 [Issue 9102] OutputRange should be ref parameter | ||||
---|---|---|---|---|
| ||||
Posted in reply to SHOO | http://d.puremagic.com/issues/show_bug.cgi?id=9102 --- Comment #10 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2013-03-24 10:08:36 PDT --- FWIW, This problem is *not* specific to CRC32. I've run into the same problem with Appender. In fact, the problem will occur with *any* struct-based OutputRange that does not specifically go out of its way to work around this problem. Furthermore, it makes absolutely no sense to pass ranges by value anyway since doing so amounts to an implicit, ad-hoc and error-prone recreation of calling '.save' - which isn't even sensible for non-ForwardRanges anyway. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 24, 2013 [Issue 9102] OutputRange should be ref parameter | ||||
---|---|---|---|---|
| ||||
Posted in reply to SHOO | http://d.puremagic.com/issues/show_bug.cgi?id=9102 --- Comment #11 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2013-03-24 10:15:55 PDT --- >Well, the problem with this is, you disable legitimate copies. For example, if I wanted to save the current state because the next few bytes passed in may not be valid. > >I don't know if this is a valid concern, but it seems like that is solving the problem by curing the symptoms. It's not a valid concern. If a range's state even *can* be saved, it is supposed to be done via '.save'. Saving a range's state via copying is undefined and reliant on the range's internal implementation details. I'll grant that maybe saving a range *should* have been defined as being done by an ordinary copy, plus postblit if necessary, and that a non-saveable range should have been defined as having postblit disabled, but unfortunately that's just not how ranges have been defined. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 24, 2013 [Issue 9102] OutputRange should be ref parameter | ||||
---|---|---|---|---|
| ||||
Posted in reply to SHOO | http://d.puremagic.com/issues/show_bug.cgi?id=9102 --- Comment #12 from Johannes Pfau <johannespfau@gmail.com> 2013-03-24 13:05:17 PDT --- I agree with Nick here. I'll open a pull request for std.digest next week which will disable the postblit and add save methods to make the copies. But AFAIK save hasn't been used with OutputRanges yet, we'll see what the pull review will bring :-) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation