[Ecls-list] A christmas gift of unboxed functions, etc (experimental)

Dave Roberts dave at vyatta.com
Thu Dec 28 21:05:01 UTC 2006


Juan Jose Garcia-Ripoll wrote:
> 2006/12/28, Dave Roberts <dave at vyatta.com>:
>> Juan Jose Garcia-Ripoll wrote:
>> >  - MAKE-ARRAY accepts a foreign pointer as an argument to 
>> :DISPLACED-TO That
>> >    creates a lisp array on top of the foreign data and can be used 
>> to directly
>> >    scan C strings, or unboxed arrays of numbers.
>>
>> Does this require one to also use :ELEMENT-TYPE ? Or does it assume a
>> particular element type (e.g. (UNSIGNED-BYTE 8) )?
> 
> You have to supply an element type. But be careful: ELEMENT-TYPE = T
> sees the foreign region as an array of pointers and that can be
> dangerous. I am not sure whether I should add a check that prevents
> this.

That was sort of the root of my question. Seems like you could easily 
forget :ELEMENT-TYPE and then it would default to T, which would give 
you that case, which could be pretty dangerous. It seemed to me like you 
might want to force :ELEMENT-TYPE to be one of a rational set of choices 
in the case where :DISPLACED-TO uses a foreign pointer, for safety.

Overall, however, the functionality is great.

-- Dave





More information about the ecl-devel mailing list