www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Slices in D vs Go

reply "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
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
Oct 18 2013
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
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
Oct 18 2013
parent reply "anonymous" <anonymous example.com> writes:
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/
Oct 19 2013
parent "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
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.
Oct 19 2013
prev sibling next sibling parent reply "Daniel Davidson" <nospam spam.com> writes:
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?
Oct 19 2013
parent reply "Daniel Davidson" <nospam spam.com> writes:
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.
Oct 19 2013
parent "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
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)
Oct 19 2013
prev sibling next sibling parent "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
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.
Oct 19 2013
prev sibling next sibling parent reply "Joseph Rushton Wakeling" <joseph.wakeling webdrake.net> writes:
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 :-)
Oct 19 2013
parent reply "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
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.
Oct 20 2013
parent reply "David Nadlinger" <code klickverbot.at> writes:
On Sunday, 20 October 2013 at 18:09:25 UTC, Jesse Phillips wrote:
 Well that is annoying. I don't have a smart phone, so I can't 
 really test
If you have a Mac, you can get the iOS emulator that comes with Xcode for free. Something similar is probably available for Android as well. You can't really test the "feel" of a website (i.e. how well a more complicated app fits in with the rest of the ecosystem), but for just checking the layout of a page, this has worked well for me. David
Oct 20 2013
next sibling parent reply Paulo Pinto <pjmlp progtools.org> writes:
Am 20.10.2013 20:12, schrieb David Nadlinger:
 On Sunday, 20 October 2013 at 18:09:25 UTC, Jesse Phillips wrote:
 Well that is annoying. I don't have a smart phone, so I can't really test
If you have a Mac, you can get the iOS emulator that comes with Xcode for free. Something similar is probably available for Android as well. You can't really test the "feel" of a website (i.e. how well a more complicated app fits in with the rest of the ecosystem), but for just checking the layout of a page, this has worked well for me. David
Yes, although if the computer lacks virtualization support it is really slow. -- Paulo
Oct 20 2013
parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
On 20 October 2013 20:13, Paulo Pinto <pjmlp progtools.org> wrote:
 Am 20.10.2013 20:12, schrieb David Nadlinger:

 On Sunday, 20 October 2013 at 18:09:25 UTC, Jesse Phillips wrote:
 Well that is annoying. I don't have a smart phone, so I can't really test
If you have a Mac, you can get the iOS emulator that comes with Xcode for free. Something similar is probably available for Android as well. You can't really test the "feel" of a website (i.e. how well a more complicated app fits in with the rest of the ecosystem), but for just checking the layout of a page, this has worked well for me. David
Yes, although if the computer lacks virtualization support it is really slow.
Your emulating iOS - regardless of virtualisation support or not it is equally slow. :o) -- Iain Buclaw *(p < e ? p++ : p) = (c & 0x0f) + '0';
Oct 20 2013
parent reply Paulo Pinto <pjmlp progtools.org> writes:
Am 20.10.2013 21:24, schrieb Iain Buclaw:
 On 20 October 2013 20:13, Paulo Pinto <pjmlp progtools.org> wrote:
 Am 20.10.2013 20:12, schrieb David Nadlinger:

 On Sunday, 20 October 2013 at 18:09:25 UTC, Jesse Phillips wrote:
 Well that is annoying. I don't have a smart phone, so I can't really test
If you have a Mac, you can get the iOS emulator that comes with Xcode for free. Something similar is probably available for Android as well. You can't really test the "feel" of a website (i.e. how well a more complicated app fits in with the rest of the ecosystem), but for just checking the layout of a page, this has worked well for me. David
Yes, although if the computer lacks virtualization support it is really slow.
Your emulating iOS - regardless of virtualisation support or not it is equally slow. :o)
I was speaking about Android. The iOS simulator is quite fast in comparisasion with the Android one. -- Paulo
Oct 20 2013
parent Michel Fortin <michel.fortin michelf.ca> writes:
On 2013-10-20 21:07:40 +0000, Paulo Pinto <pjmlp progtools.org> said:

 Am 20.10.2013 21:24, schrieb Iain Buclaw:
 Your emulating iOS - regardless of virtualisation support or not it is
 equally slow.  :o)
I was speaking about Android. The iOS simulator is quite fast in comparisasion with the Android one.
Indeed. And that's because it isn't an emulator. What you run in the iOS simulator is a x86 version of an iOS app linked against the iOS simulator SDK and it runs as a regular OS X process. This works fine because the underlying OS is pretty much the same. -- Michel Fortin michel.fortin michelf.ca http://michelf.ca
Oct 20 2013
prev sibling next sibling parent "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
On Sunday, 20 October 2013 at 18:12:06 UTC, David Nadlinger wrote:
 On Sunday, 20 October 2013 at 18:09:25 UTC, Jesse Phillips 
 wrote:
 Well that is annoying. I don't have a smart phone, so I can't 
 really test
If you have a Mac, you can get the iOS emulator that comes with Xcode for free. Something similar is probably available for Android as well. You can't really test the "feel" of a website (i.e. how well a more complicated app fits in with the rest of the ecosystem), but for just checking the layout of a page, this has worked well for me. David
Well, there isn't much I can do about it, short of hosting my own blog. Looking at other hosted blogs doesn't lead me to believing that such problems are solved, I've taken the same approach and just set a max-width of 500. Frankly, I'm with Adam on the everything sucks side.
Oct 20 2013
prev sibling parent reply "w0rp" <devw0rp gmail.com> writes:
What's this talk of emulators? Just Google the width of 
smartphone screens and try resizing your browser window with 
similar font size settings. It should be close enough to design 
something decent for phones with.
Oct 22 2013
next sibling parent "w0rp" <devw0rp gmail.com> writes:
Oh, and cool article. I liked it.
Oct 22 2013
prev sibling parent "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
On Tuesday, 22 October 2013 at 20:49:04 UTC, w0rp wrote:
 What's this talk of emulators? Just Google the width of 
 smartphone screens and try resizing your browser window with 
 similar font size settings. It should be close enough to design 
 something decent for phones with.
Well, I can't say that LJ would use the same desktop formatting for such devices. I'd have to modify the User Agent to pretend it was not a desktop. Anyway, 500 seems good for desktop and mobile. Wouldn't really want to go lower. Thanks and it seems it was quite a hit on Reddit too.
Oct 22 2013
prev sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
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
http://www.reddit.com/r/programming/comments/1owpmp/slices_in_d_vs_go/ Andrei
Oct 21 2013