Re: [go-nuts] The [low:high] expression for creating slices

2016-10-20 Thread Nyah Check
Thanks! On Thu, Oct 20, 2016 at 3:25 PM, Konstantin Khomoutov < flatw...@users.sourceforge.net> wrote: > On Thu, 20 Oct 2016 09:45:07 +0100 > Nyah Check wrote: > > > My understanding of the [low:high] expression is Go is creating > > slices when you're copying data from an already existing slice

Re: [go-nuts] The [low:high] expression for creating slices

2016-10-20 Thread Konstantin Khomoutov
On Thu, 20 Oct 2016 09:45:07 +0100 Nyah Check wrote: > My understanding of the [low:high] expression is Go is creating > slices when you're copying data from an already existing slice. Is it > possible to use the expression when you're creating a slice without > copying data from another slice? I

Re: [go-nuts] The [low:high] expression for creating slices

2016-10-20 Thread Nyah Check
> > ng to that region in memory at run time? Or does it just reference only > that part of the existing slice. Like it's done with pointers? > > "If the sliced operand of a valid slice expression is a nil slice, the > result is a nil slice. Otherwise, the result shares its underlying array > with t

Re: [go-nuts] The [low:high] expression for creating slices

2016-10-20 Thread Jan Mercl
On Thu, Oct 20, 2016 at 11:33 AM Nyah Check wrote: > I thought that expression allocates memory corresponding to that region in memory at run time? Or does it just reference only that part of the existing slice. Like it's done with pointers? "If the sliced operand of a valid slice expression is

Re: [go-nuts] The [low:high] expression for creating slices

2016-10-20 Thread Nyah Check
Hi Jan, > > Slicing does not copy any of the backing array items. > > > I thought that expression allocates memory corresponding to that region in memory at run time? Or does it just reference only that part of the existing slice. Like it's done with pointers? Cheers! -- You received this mess

Re: [go-nuts] The [low:high] expression for creating slices

2016-10-20 Thread Jan Mercl
On Thu, Oct 20, 2016 at 10:45 AM Nyah Check wrote: > My understanding of the [low:high] expression is Go is creating slices when you're copying data from an already existing slice. Is it possible to use the expression when you're creating a slice without copying data from another slice? If yes, I

[go-nuts] The [low:high] expression for creating slices

2016-10-20 Thread Nyah Check
Hi Devs, My understanding of the [low:high] expression is Go is creating slices when you're copying data from an already existing slice. Is it possible to use the expression when you're creating a slice without copying data from another slice? If yes, I'll appreciate some use cases. Thanks, Nyah