On Friday, 8 April 2016 at 12:45:59 UTC, Xinok wrote:
On Friday, 8 April 2016 at 10:15:10 UTC, Dicebot wrote:
On Friday, 8 April 2016 at 09:56:41 UTC, Nick Treleaven wrote:
Semantically, array literals are always allocated on the
heap. In this case, the optimizer can obviously place the
array
On Friday, 8 April 2016 at 10:15:10 UTC, Dicebot wrote:
On Friday, 8 April 2016 at 09:56:41 UTC, Nick Treleaven wrote:
Semantically, array literals are always allocated on the
heap. In this case, the optimizer can obviously place the
array on the stack or even make it static/global.
So @nogc
On Friday, 8 April 2016 at 10:11:43 UTC, Rene Zwanenburg wrote:
On Friday, 8 April 2016 at 09:56:41 UTC, Nick Treleaven wrote:
If the comparison with b shouldn't be allowed, I suggest we
add opEquals to std.range.only. This removes a need to import
std.algorithm.equal and reduces bracket
On Friday, 8 April 2016 at 09:56:41 UTC, Nick Treleaven wrote:
Semantically, array literals are always allocated on the heap.
In this case, the optimizer can obviously place the array on
the stack or even make it static/global.
So @nogc is enforced by the optimizer?
Yes, sadly. To make it
On Friday, 8 April 2016 at 09:56:41 UTC, Nick Treleaven wrote:
If the comparison with b shouldn't be allowed, I suggest we add
opEquals to std.range.only. This removes a need to import
std.algorithm.equal and reduces bracket nesting:
assert(b == only(1, 2));
equal[1] can compare ranges of
On Friday, 8 April 2016 at 03:14:40 UTC, Xinok wrote:
On Friday, 8 April 2016 at 01:36:18 UTC, rcorre wrote:
@nogc unittest {
int[2] a = [1, 2];
assert(a == [1, 2]); // OK
immutable(int)[2] b = [1, 2];
assert(b == [1, 2]); // fail: array literal may cause
allocation
}
Is
On Friday, 8 April 2016 at 01:36:18 UTC, rcorre wrote:
@nogc unittest {
int[2] a = [1, 2];
assert(a == [1, 2]); // OK
immutable(int)[2] b = [1, 2];
assert(b == [1, 2]); // fail: array literal may cause
allocation
}
Is there any logic behind allowing the comparison with `a`
@nogc unittest {
int[2] a = [1, 2];
assert(a == [1, 2]); // OK
immutable(int)[2] b = [1, 2];
assert(b == [1, 2]); // fail: array literal may cause
allocation
}
Is there any logic behind allowing the comparison with `a` but
not `b`, or is this a compiler bug?