Brad Roberts via Digitalmars-d
2014-10-13 00:41:58 UTC
I've been spot checking parts of phobos today to see what all isn't
@safe ready. I'm not shocked that Array isn't, but doesn't it need to be?
For instance, not even the most basic of uses works:
$ git diff -U5
diff --git a/std/container/array.d b/std/container/array.d
index 4a1bfb4..2672bc6 100644
--- a/std/container/array.d
+++ b/std/container/array.d
@@ -826,11 +826,11 @@ $(D r)
length = offset1 + tailLength;
return this[length - tailLength .. length];
}
}
-unittest
+ at safe unittest
{
Array!int a;
assert(a.empty);
}
==> std/container/array.d(833): Error: safe function
'std.container.array.__unittestL831_1' cannot call system function
'std.container.array.Array!int.Array.~this'
I know it's a tricky implementation, but let's focus on the goal..
should Array be usable in @safe code?
@safe ready. I'm not shocked that Array isn't, but doesn't it need to be?
For instance, not even the most basic of uses works:
$ git diff -U5
diff --git a/std/container/array.d b/std/container/array.d
index 4a1bfb4..2672bc6 100644
--- a/std/container/array.d
+++ b/std/container/array.d
@@ -826,11 +826,11 @@ $(D r)
length = offset1 + tailLength;
return this[length - tailLength .. length];
}
}
-unittest
+ at safe unittest
{
Array!int a;
assert(a.empty);
}
==> std/container/array.d(833): Error: safe function
'std.container.array.__unittestL831_1' cannot call system function
'std.container.array.Array!int.Array.~this'
I know it's a tricky implementation, but let's focus on the goal..
should Array be usable in @safe code?