On 2010-02-08 14:31:06 -0500, bearophile <[email protected]> said:
Michel Fortin:
I think SafeD as currently implemented has the right design, except
when it comes to passing delegates and functions as arguments to
templates or functions.
The less significant bit of the function/delegate pointer can be used
to denote safe/unsafe :o)
What would be the point?
The problem is when you have a safe function taking a delegate, like this:
@safe void test(void delegate() run) {
run();
}
void main() {
test({ writeln("hello world"); });
}
Here, the delegate literal is unsafe and you give it to a safe
function. The compiler disallow test() from calling run() because it is
unsafe. This is just too restricting. Do we really want to have to
create two versions of test(), one with a safe delegate the other with
an unsafe one?
--
Michel Fortin
[email protected]
http://michelf.com/