[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: name an array function

From: Daniel Llorens
Subject: Re: name an array function
Date: Mon, 21 Nov 2016 15:38:02 +0100

On 21 Nov 2016, at 15:01, Panicz Maciej Godek <address@hidden> wrote:

> As far as accessors are concerned, I'm not sure whether they actaully need 
> names. Maybe it would be better to make them applicable, and produce 
> "procedures with setters"?

I'd absolutely prefer (A i j) to (array-whatever A i j). Arrays *are* functions 
of indices.

But the mechanism for applicable objects isn't being used right now for any of 
the data structures with accessors. It isn't documented in the manual, either. 
I don't know how it works. Some patches are needed there, examples. Moreover if 
the type of arrays is changed (which I believe is needed to make arrays an 
applicable object), then we must retain compatibility with all the existing 
array procedures. I like the idea, but I don't think it's going to happen for 

Procedures with setters would remove the need for the modifying function 
(array-slice-copy! or whatever it ends up being called), but this isn't done 
now even for the pair array-ref / array-set!. However it is easier to implement.

My idea has always been to move the array descriptor (storage pointer, strides, 
etc), which is now an opaque C object, to Scheme. Then we could do lots of 
stuff without having to rebuild Guile, take advantage of compiler 
optimizations, etc. But even that isn't in the cards for 2.2. At least I don't 
think anyone is working on it.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]