[Issue 9102] OutputRange should be ref parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 25 11:26:33 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9102



--- Comment #9 from Johannes Pfau <johannespfau at gmail.com> 2013-02-25 11:26:32 PST ---
> 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.

Problem is that the std.digest interface doesn't guarantee that a trivial bit
copy actually saves the state. This is deliberate to allow wrappers to OpenSSL
or other C hash functions to be written as structs (Although it's questionable
if those shouldn't be done as OOP API only). Also the risk of unwanted copies
is high (e.g. when passing to a function).

If a way to copy digests is needed we could always implement an explicit
copy/save function for this and enforce all isDigest types to implement this.
This would also work for wrapper types or types which have to keep any kind of
internal reference.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list