Language Subsets

Jakob Ovrum jakobovrum at gmail.com
Sat Apr 21 10:36:07 PDT 2012


On Saturday, 21 April 2012 at 15:33:08 UTC, Marco Leise wrote:
> Since noone answered, I don't know what you heard in the video, 
> but from my experience @safe is the only real subset that 
> exists. And for you as the developer it means, that you can not 
> use I/O and operations on pointers. Also when compiling in 
> -release mode @safe keeps array bounds checks, while @system 
> drops those checks. I imagine @safe code as encapsulated. It 
> cannot talk to the outside world or access unrelated parts 
> through pointer arithmetic. (Although, you can always call 
> @trusted code which in turn calls @system code.) It's probably 
> comparable to programming in a VM language like Java. You can 
> apply @safe to either single functions or right at the top of 
> your module to cover all code like so: "@safe:".
>
> A feature table of @safe/@system is probably overkill, since 
> most features still work. You just lose ASM/pointer arithmetics 
> and direct calls to @system functions (which is the default). 
> Work is on the way to mark as much of Phobos @safe as possible, 
> since some functions still miss that attribute.

There is a list at:

     http://dlang.org/function.html#function-safety

And a separate, apparently less-maintained list at:

     http://dlang.org/memory-safe-d.html

Phobos' I/O routines are @trusted, hence you can use them in 
SafeD.

SafeD is the only defined language subset of D that the 
specification and compiler deal with.


More information about the Digitalmars-d mailing list