[Issue 11240] assumeSafeAppend could implicitly break immutablity

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 13 01:39:20 PDT 2013


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


Jonathan M Davis <jmdavisProg at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg at gmx.com


--- Comment #3 from Jonathan M Davis <jmdavisProg at gmx.com> 2013-10-13 01:39:14 PDT ---
I concur with monarchdodra. I think that this would be too strong a
restriction. assumeSafeAppend is already @system. You're already not supposed
to be calling it on an array that isn't actually safe to append to. The
constness of the array doesn't change that. Maybe more explicit warnings should
be put in the documentation for assumeSafeAppend, but the documentation is
already pretty clear that you shouldn't use it if it's not actually safe to
append.

I think that if assumeSafeAppend is misused, it's clearly a bug on the part of
the caller and not assumeSafeAppend, even if that bug involves const or
immutable. And given that the most likely type to use with assumeSafeAppend is
probably string, restricting it to only work with mutable elements would be
really reduce its usefulness.

-- 
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