Does D have too many features?

Jonathan M Davis jmdavisProg at gmx.com
Sun Apr 29 01:46:25 PDT 2012


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.

- Jonathan M Davis


More information about the Digitalmars-d mailing list