Thread overview | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 19, 2013 Slices in D vs Go | ||||
---|---|---|---|---|
| ||||
Do to the recent slices discussion I did some investigation on what is different in Go. Thus, created this http://he-the-great.livejournal.com/48672.html |
October 19, 2013 Re: Slices in D vs Go | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On 10/18/13 9:52 PM, Jesse Phillips wrote:
> Do to the recent slices discussion I did some investigation on what is
> different in Go. Thus, created this
>
> http://he-the-great.livejournal.com/48672.html
s/compliment/complement/
?
Andrei
|
October 19, 2013 Re: Slices in D vs Go | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Saturday, 19 October 2013 at 05:52:05 UTC, Andrei Alexandrescu wrote: > On 10/18/13 9:52 PM, Jesse Phillips wrote: [...] >> http://he-the-great.livejournal.com/48672.html > > s/compliment/complement/ also s/underlining/underlying/ |
October 19, 2013 Re: Slices in D vs Go | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On Saturday, 19 October 2013 at 04:52:31 UTC, Jesse Phillips wrote:
> Do to the recent slices discussion I did some investigation on what is different in Go. Thus, created this
>
> http://he-the-great.livejournal.com/48672.html
It starts with:
int[] original;
original.reserve(5);
writeln("orig cap: ", original.capacity); // 7
writeln("orig len: ", original.length); // 0
Further down says: "But to discuss behavior we'll need some elements."
and immediately proceeds with code accessing original where no data has been added:
auto slice = original[1..$];
writeln("slice cap: ", slice.capacity); // 6
writeln("slice len: ", slice.length); // 2
original[0]++;
slice[0]++;
slice[1]++;
writeln("orig: ", original); // [1, 2, 3]
I don't know where the [1,2,3] comes from. The first original[1..$] will crash. Maybe you are forgetting the actual initialization of original with data?
|
October 19, 2013 Re: Slices in D vs Go | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Davidson | On Saturday, 19 October 2013 at 12:08:49 UTC, Daniel Davidson wrote:
> On Saturday, 19 October 2013 at 04:52:31 UTC, Jesse Phillips wrote:
>> Do to the recent slices discussion I did some investigation on what is different in Go. Thus, created this
>>
>> http://he-the-great.livejournal.com/48672.html
>
> It starts with:
> int[] original;
> original.reserve(5);
> writeln("orig cap: ", original.capacity); // 7
> writeln("orig len: ", original.length); // 0
>
> Further down says: "But to discuss behavior we'll need some elements."
>
> and immediately proceeds with code accessing original where no data has been added:
>
> auto slice = original[1..$];
> writeln("slice cap: ", slice.capacity); // 6
> writeln("slice len: ", slice.length); // 2
> original[0]++;
> slice[0]++;
> slice[1]++;
> writeln("orig: ", original); // [1, 2, 3]
>
> I don't know where the [1,2,3] comes from. The first original[1..$] will crash. Maybe you are forgetting the actual initialization of original with data?
Ahh ok. You may want to point to the fact that you are referring to a larger and complete code file linked at the bottom of the page.
|
October 19, 2013 Re: Slices in D vs Go | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Davidson | On Saturday, 19 October 2013 at 12:12:19 UTC, Daniel Davidson wrote:
>> I don't know where the [1,2,3] comes from. The first original[1..$] will crash. Maybe you are forgetting the actual initialization of original with data?
>
> Ahh ok. You may want to point to the fact that you are referring to a larger and complete code file linked at the bottom of the page.
No, you are completely correct. I'd copied in the wrong sections. It is supposed to be something you can build, so I'll mention that.
(Also fixed spelling)
|
October 19, 2013 Re: Slices in D vs Go | ||||
---|---|---|---|---|
| ||||
Posted in reply to anonymous | On Saturday, 19 October 2013 at 08:45:55 UTC, anonymous wrote:
> On Saturday, 19 October 2013 at 05:52:05 UTC, Andrei Alexandrescu wrote:
>> On 10/18/13 9:52 PM, Jesse Phillips wrote:
> [...]
>>> http://he-the-great.livejournal.com/48672.html
>>
>> s/compliment/complement/
>
> also s/underlining/underlying/
Thanks, done.
|
October 19, 2013 Re: Slices in D vs Go | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On Saturday, 19 October 2013 at 04:52:31 UTC, Jesse Phillips wrote:
> Do to the recent slices discussion I did some investigation on what is different in Go. Thus, created this
>
> http://he-the-great.livejournal.com/48672.html
And now it is all formatted.
I'd forgotten vim has TOhtml, though with LJ you'll first need
:let g:html_use_css = 0
Also, much easier to format LJ when auto format is off.
|
October 20, 2013 Re: Slices in D vs Go | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On Saturday, 19 October 2013 at 04:52:31 UTC, Jesse Phillips wrote:
> Do to the recent slices discussion I did some investigation on what is different in Go. Thus, created this
>
> http://he-the-great.livejournal.com/48672.html
It's not a big deal, but your blog's fixed width makes it a little annoying to read off a smartphone -- it's necessary to keep scrolling back and forth horizontally in order to read the text.
Enjoyed reading the article, though :-)
|
October 20, 2013 Re: Slices in D vs Go | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | On Sunday, 20 October 2013 at 01:59:14 UTC, Joseph Rushton Wakeling wrote: > On Saturday, 19 October 2013 at 04:52:31 UTC, Jesse Phillips wrote: >> Do to the recent slices discussion I did some investigation on what is different in Go. Thus, created this >> >> http://he-the-great.livejournal.com/48672.html > > It's not a big deal, but your blog's fixed width makes it a little annoying to read off a smartphone -- it's necessary to keep scrolling back and forth horizontally in order to read the text. > > Enjoyed reading the article, though :-) Well that is annoying. I don't have a smart phone, so I can't really test, my tablet seems to remove all the styling which would suggest text would have more flow. And at least for the desktop version, the main site is slightly smaller (due to the panel) http://he-the-great.livejournal.com/ but that isn't a good link to a specific article. |
Copyright © 1999-2021 by the D Language Foundation