Re: opSlice() or opIndex() for the entire slice?

2014-09-09 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Sep 04, 2014 at 09:04:33PM +, monarch_dodra via Digitalmars-d-learn wrote: On Thursday, 4 September 2014 at 19:12:27 UTC, Ali Çehreli wrote: The documentation says To overload a[], simply define opIndex with no parameters: http://dlang.org/operatoroverloading.html#Slice And

Re: opSlice() or opIndex() for the entire slice?

2014-09-09 Thread Ali Çehreli via Digitalmars-d-learn
On 09/09/2014 09:56 PM, H. S. Teoh via Digitalmars-d-learn wrote: Kenji's PR that implements multidimensional slicing; in his design, he specifically relegates opSlice to returning index range proxy objects That's exactly how it finally made sense to me. :) By extension, therefore, it

Re: opSlice() or opIndex() for the entire slice?

2014-09-07 Thread Ali Çehreli via Digitalmars-d-learn
I think I figured this one out. Before 2.066, we did not have proper support for multi-dimensional slicing. The following were the semantics we had: -- The opIndex() overloads provided access to direct elements. Since multi-dimensional support was incomplete, opIndex() was about accessing a

opSlice() or opIndex() for the entire slice?

2014-09-04 Thread Ali Çehreli via Digitalmars-d-learn
The documentation says To overload a[], simply define opIndex with no parameters: http://dlang.org/operatoroverloading.html#Slice And it works with some uses of a[]. However, opSlice() seems to be needed to actually use the returned slice further. Note that opSlice() also seems to be for

Re: opSlice() or opIndex() for the entire slice?

2014-09-04 Thread via Digitalmars-d-learn
On Thursday, 4 September 2014 at 19:12:27 UTC, Ali Çehreli wrote: The documentation says To overload a[], simply define opIndex with no parameters: http://dlang.org/operatoroverloading.html#Slice And it works with some uses of a[]. However, opSlice() seems to be needed to actually use the

Re: opSlice() or opIndex() for the entire slice?

2014-09-04 Thread monarch_dodra via Digitalmars-d-learn
On Thursday, 4 September 2014 at 19:12:27 UTC, Ali Çehreli wrote: The documentation says To overload a[], simply define opIndex with no parameters: http://dlang.org/operatoroverloading.html#Slice And it works with some uses of a[]. However, opSlice() seems to be needed to actually use the

Re: opSlice() or opIndex() for the entire slice?

2014-09-04 Thread Ali Çehreli via Digitalmars-d-learn
On 09/04/2014 12:19 PM, Marc Schütz schue...@gmx.net wrote: On Thursday, 4 September 2014 at 19:12:27 UTC, Ali Çehreli wrote: The documentation says To overload a[], simply define opIndex with no parameters: http://dlang.org/operatoroverloading.html#Slice And it works with some uses of a[].

Re: opSlice() or opIndex() for the entire slice?

2014-09-04 Thread Ali Çehreli via Digitalmars-d-learn
On 09/04/2014 02:04 PM, monarch_dodra wrote: On Thursday, 4 September 2014 at 19:12:27 UTC, Ali Çehreli wrote: The documentation says To overload a[], simply define opIndex with no parameters: http://dlang.org/operatoroverloading.html#Slice And it works with some uses of a[]. However,