digitalmars.D - News/info on Go and Java
- bearophile (7/7) Nov 24 2009 Found on Reddit:
- Denis Koroskin (4/11) Nov 25 2009 Looks like go has arrays that support slices. Do they support appending?...
- Andrei Alexandrescu (8/24) Nov 25 2009 There's no built-in means to grow a slice. An example given in
- Sergey Gromov (13/21) Nov 26 2009 Arrays are values and cannot be resized after creation.
- bearophile (5/6) Nov 26 2009 Is []int better than int[] ?
- retard (4/11) Nov 26 2009 You could change to syntax for AAs to be 5 -> 7 since D doesn't use ->
- Sergey Gromov (5/11) Nov 26 2009 Well, try to read aloud int[5][10]. I come up with "Integer, five of
Found on Reddit: This looks a lot like D: http://research.swtch.com/2009/11/go-data-structures.html New features in Java, some of them look like D: http://code.joejag.com/2009/new-language-features-in-java-7/ Bye, bearophile
Nov 24 2009
On Wed, 25 Nov 2009 03:03:59 +0300, bearophile <bearophileHUGS lycos.com> wrote:Found on Reddit: This looks a lot like D: http://research.swtch.com/2009/11/go-data-structures.html New features in Java, some of them look like D: http://code.joejag.com/2009/new-language-features-in-java-7/ Bye, bearophileLooks like go has arrays that support slices. Do they support appending? If so, what's their behavior and how do they solve stomping issues?
Nov 25 2009
Denis Koroskin wrote:On Wed, 25 Nov 2009 03:03:59 +0300, bearophile <bearophileHUGS lycos.com> wrote:There's no built-in means to grow a slice. An example given in "Effective Go" appends to slices without regard to stomping or dissolving sharing: http://golang.org/doc/effective_go.html Slices are obese pointers storing the pointer/length/capacity troika. I think D is in better shape here. AndreiFound on Reddit: This looks a lot like D: http://research.swtch.com/2009/11/go-data-structures.html New features in Java, some of them look like D: http://code.joejag.com/2009/new-language-features-in-java-7/ Bye, bearophileLooks like go has arrays that support slices. Do they support appending? If so, what's their behavior and how do they solve stomping issues?
Nov 25 2009
Wed, 25 Nov 2009 12:27:59 +0300, Denis Koroskin wrote:On Wed, 25 Nov 2009 03:03:59 +0300, bearophile <bearophileHUGS lycos.com> wrote:Arrays are values and cannot be resized after creation. var array [10]int; Arrays can be sliced like in D: var slice []int = array[5:7]; The length of this slice is len(slice) == 7 - 5 == 2. The *capacity* of this slice is cap(slice) == 10 - 5 == 5. You can slice a slice beyond its length, up to capacity: var slice2 []int = slice[4:5]; Effectively slice is a tail of an array, with optional subdivision into sub-head and sub-tail. There is no array nor slice concatenation, nor any other way to change slice length except slicing.This looks a lot like D: http://research.swtch.com/2009/11/go-data-structures.htmlLooks like go has arrays that support slices. Do they support appending? If so, what's their behavior and how do they solve stomping issues?
Nov 26 2009
Sergey Gromov:var slice []int = array[5:7];Is []int better than int[] ? [5:7] is a slice syntax a bit better than [5..7] (and it's used in Python). But in D [5:7] is the literal for an AA... Bye, bearophile
Nov 26 2009
Thu, 26 Nov 2009 11:58:23 -0500, bearophile wrote:Sergey Gromov:You could change to syntax for AAs to be 5 -> 7 since D doesn't use -> for lambdas :) And even when D starts supporting them, they could use => instead.var slice []int = array[5:7];Is []int better than int[] ? [5:7] is a slice syntax a bit better than [5..7] (and it's used in Python). But in D [5:7] is the literal for an AA...
Nov 26 2009
Thu, 26 Nov 2009 11:58:23 -0500, bearophile wrote:Sergey Gromov:Well, try to read aloud int[5][10]. I come up with "Integer, five of them, ten times." While [10][5]int is "Array of ten arrays of integers." It's *much* clearer.var slice []int = array[5:7];Is []int better than int[] ?[5:7] is a slice syntax a bit better than [5..7] (and it's used in Python). But in D [5:7] is the literal for an AA...In Go, it'd be map[int]int{5:7}.
Nov 26 2009