DIP23 draft: Fixing properties redux
Steven Schveighoffer
schveiguy at yahoo.com
Tue Feb 5 13:53:51 PST 2013
On Tue, 05 Feb 2013 16:43:39 -0500, Jonathan M Davis <jmdavisProg at gmx.com>
wrote:
> On Tuesday, February 05, 2013 14:05:24 Steven Schveighoffer wrote:
>> I think the point about @safe code is moot, aren't pointers disallowed
>> in
>> safe code anyway?
>
> Goodness no. It's pointer arithmetic which is disallowed. Pointers
> themselves
> are perfectly safe as long as you just pass them around or dereference
> them
> (which would include calling functions on them). For instance, the
> result of
> in on an AA is a pointer to the object, and that's @safe.
Well, it would seem setting all kinds of extra rules on ref (in addition
to the restrictions we have now), when pointers are more useful even in
@safe code, will simply result in people using pointers more than ref.
I'm not sure that's the right message, but I'm afraid that will be what it
is.
For example, I have to use pointers for my linked list implementation in
dcollections, because ref is forbidden to be used as a class or struct
member (my nodes are structs because classes are too heavy). Also, ref is
not rebindable, whereas a pointer is.
-Steve
More information about the Digitalmars-d
mailing list