On Thu, 22 Nov 2012 06:10:04 -0600, John Colvin <john.loughran.col...@gmail.com> wrote:

On Wednesday, 21 November 2012 at 19:40:25 UTC, Mike Wey wrote:
If you want to use this syntax with images, DMagick's ImageView might be interesting:
http://dmagick.mikewey.eu/docs/ImageView.html

I like it :)
From what I can see it provides exactly what i'm talking about for 2D. I haven't looked at the implementation in detail, but do you think that such an approach could be scaled up to arbitrary N-dimensional arrays?

Yes and no. Basically, like an array, an ImageView is a thick pointer and as the dimensions increase the pointer gets thicker by 1-2 words a dimension. And each indexing or slicing operation has to create a temporary with this framework, which leads to stack churn as the dimensions get large. An another syntax that can be used until we get true, multi-dimensional slicing is to use opIndex with int[2] arguments, i.e: view[[4,40],[5,50]] = new Color("red");

Reply via email to