Does D have too many features?
H. S. Teoh
hsteoh at quickfur.ath.cx
Sun Apr 29 19:21:22 PDT 2012
On Sun, Apr 29, 2012 at 01:46:25AM -0700, Jonathan M Davis wrote:
> On Sunday, April 29, 2012 10:37:10 Timon Gehr wrote:
> > Well, what if the programmer "knows" that foo does not change 'aa',
> > but it actually does? Then there would possibly be a segmentation
> > fault. This implies that the 'in' operator cannot be used in @safe
> > code. (Or there would have to be a special case, that allows 'in' if
> > the result is directly cast to bool.)
>
> It's exactly as safe as any iterator or range which could be
> invalidated - both of which can occur in safe code. Any of those could
> blow up in entertaining ways if you use them after they've been
> invalidated.
>
> Pointers are considered safe. It's pointer arithmetic which isn't.
[...]
I get that this discussion is about what type 'in' should return, but
taking a step back, isn't it all moot because you could just use the
.get() method?
T
--
Let's not fight disease by killing the patient. -- Sean 'Shaleh' Perry
More information about the Digitalmars-d
mailing list