[swift-evolution] Proposal: Contiguous Variables (A.K.A. Fixed Sized Array Type)

John Randolph jcr at mac.com
Mon Feb 1 10:42:57 CST 2016


> On Jan 29, 2016, at 2:40 AM, Tino Heth via swift-evolution <swift-evolution at swift.org> wrote:
> am I the only one who get creeps because of that "x" in the declaration? I

I really don’t like the x as an operator either, because I use x for so many other things in my code. 

My typical use case for contiguous variables would be images, e.g:

struct RGBAPixel {
	var red: Int8
	var green:Int8
	var blue:Int8
	var alpha:Int8
}

let myImage : RGBAPixel[512 * 515] = someCFunctionThatReturnsABitmap() as! RGBAPixel[]

I recently needed to do this kind of thing in a Swift tool that converted images into CIColorCubes, and it was nightmarish.   I almost reverted to C to get it done.

On a related note, I’d really love to have a way to declare multi-dimensional arrays and be able to name the axes.   

-jcr


More information about the swift-evolution mailing list