safety model in D

jpf spam at example.com
Wed Nov 4 08:50:03 PST 2009


Andrei Alexandrescu wrote:
> How can we address that? Again, I'm looking for a simple, robust,
> extensible design that doesn't lock our options.
> 
> 
> Thanks,
> 
> Andrei
You may want to have a look at the CoreCLR security model (that's used
by silverlight / moonlight). It's quite similar to what you've proposed.
http://www.mono-project.com/Moonlight2CoreCLR#Security_levels

Btw, is there a reason why safety should be specified at the module
level? As we have attributes now that would be a perfect usecase for
them: example:

@Safety(Safe)
void doSomething()...

or:
@Safety.Critical
void doSomething()...

where that attribute could be applied to functions, classes, modules, ...

Another related question: Will there be a way to provide different
implementations for different safety levels?

version(Safety.Critical)
{
   //Some unsafe yet highly optimized asm stuff here
}
else
{
   //Same thing in safe
}



More information about the Digitalmars-d mailing list