On Saturday, 12 March 2016 at 08:09:41 UTC, Dmitry Olshansky
wrote:
On 05-Mar-2016 14:05, Dmitry Olshansky wrote:
Obligatory slides:
http://slides.com/dmitryolshansky/deck/fullscreen/
There are 2 bugs in
http://slides.com/dmitryolshansky/deck/fullscreen/#/4/1
--- zzz0.d 2016-03-13 22:10:44.548974800 +0300
+++ zzz1.d 2016-03-13 22:11:54.653984600 +0300
@@ -2,7 +2,7 @@
// slice is dynamic array on GC heap
int[] slice = [1, 2, 3, 4, 5];
// slice the range of [1:3)
- int[] a = slice[1..3];
+ int[] a = slice[1..4];
assert(a == [2,3,4]);
a ~= 6; // append 6
@@ -15,7 +15,7 @@
int[] b = a.dup; // duplicate (=copy)
b[0] = 10;
- assert(a[0] == 8);
+ assert(a[0] == 4);
assert(*a.ptr == 4);
int k = 1;