On Thu, 05 Nov 2009 21:17:08 -0500, Walter Bright
<newshou...@digitalmars.com> wrote:
Steven Schveighoffer wrote:
But what if I don't what the whole function to be trusted, just that
creation section? I have to create a new function just to create the
data?
Separate out the trusted code to a separate function.
Although that's a solution, it seems artificial to have to build a
separate function just to allocate some immutable object. If unsafe code
is truly going to be a rare occurrence, you might want to allow as fine
grained control as possible over where the compiler ignores safety.
Having to create artificial boundaries that cause performance
problems/code bloat doesn't seem right to me.
However, I'll let it go, I don't know the ramifications since allocating
immutable objects is a rare occurrence, and I'm not sure how it will be
done. I am also not sure how solid a use case this is (allocating an
object, then manipulating it via methods before changing it to immutable).
-Steve