Re: Tuple indexing and slicing

2013-07-11 Thread Timothee Cour
On Thu, Jul 11, 2013 at 1:05 AM, Simen Kjaeraas wrote: > On 2013-07-11, 00:52, Timothee Cour wrote: > > Why not support Tuple indexing and slicing with [] syntax? >> (see below for a way to index/slice a tuple) >> >> void main(){ >> alias T=Tuple!(int,doubl

Re: Tuple indexing and slicing

2013-07-11 Thread Simen Kjaeraas
On 2013-07-11, 00:52, Timothee Cour wrote: Why not support Tuple indexing and slicing with [] syntax? (see below for a way to index/slice a tuple) void main(){ alias T=Tuple!(int,double); pragma(msg,T[0].stringof);//_expand_field_0 //pragma(msg,T[0..2].stringof); //Error: cannot slice

Re: Tuple indexing and slicing

2013-07-10 Thread Timothee Cour
On Wed, Jul 10, 2013 at 6:16 PM, Jonathan M Davis wrote: > On Wednesday, July 10, 2013 18:10:42 Timothee Cour wrote: > > On Wed, Jul 10, 2013 at 5:49 PM, Artur Skawina > wrote: > > > On 07/11/13 00:52, Timothee Cour wrote: > > > > Why not support Tuple in

Re: Tuple indexing and slicing

2013-07-10 Thread Jonathan M Davis
On Wednesday, July 10, 2013 18:10:42 Timothee Cour wrote: > On Wed, Jul 10, 2013 at 5:49 PM, Artur Skawina wrote: > > On 07/11/13 00:52, Timothee Cour wrote: > > > Why not support Tuple indexing and slicing with [] syntax? > > > > > > (see below for a way

Re: Tuple indexing and slicing

2013-07-10 Thread Timothee Cour
On Wed, Jul 10, 2013 at 5:49 PM, Artur Skawina wrote: > On 07/11/13 00:52, Timothee Cour wrote: > > Why not support Tuple indexing and slicing with [] syntax? > > (see below for a way to index/slice a tuple) > > Not sure I understand the question. > I guess you'

Re: Tuple indexing and slicing

2013-07-10 Thread Artur Skawina
On 07/11/13 00:52, Timothee Cour wrote: > Why not support Tuple indexing and slicing with [] syntax? > (see below for a way to index/slice a tuple) Not sure I understand the question. I guess you'd like this to work for some library pseudo-tuple type - I've not looked at those, s

Re: Tuple indexing and slicing

2013-07-10 Thread bearophile
Timothee Cour: Why not support Tuple indexing and slicing with [] syntax? You need a syntax like: a.slice!(1, 3); I don't know why Walter didn't add support for a slicing syntax for tuples. But it's an additive change, so it's not too much late to add it, if it's f

Tuple indexing and slicing

2013-07-10 Thread Timothee Cour
Why not support Tuple indexing and slicing with [] syntax? (see below for a way to index/slice a tuple) void main(){ alias T=Tuple!(int,double); pragma(msg,T[0].stringof);//_expand_field_0 //pragma(msg,T[0..2].stringof); //Error: cannot slice type 'Tuple!(int, double) pragma(msg,t