[plt-scheme] Re: MysterX and arrays/vectors

From: Filipe Cabecinhas (filcab at gmail.com)
Date: Tue Mar 25 15:56:01 EDT 2008

On 25 Mar, 2008, at 18:40, Eli Barzilay wrote:
> On Mar 25, Filipe Cabecinhas wrote:
>>
>> Now I have a small problem. The ActiveX library I'm using doesn't
>> tell me what object it's expecting in it's function. I thought it
>> was an array of doubles but it must be an array of floats. I will
>> try it with a small hack (wether it's a double or a float, fill
>> both. But I wanted to know how to build MzScheme with
>> USE_SINGLE_FLOATS in Windows (I just can't get around Visual
>> Studio). I suppose there's no way to have a single float without
>> enabling that.
>
> I'm not sure about using single floats for your own build, but if
> there's a patch that you want to submit for MysterX, then it should be
> working with doubles (I think).
> --          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli  
> Barzilay:
>            http://www.barzilay.org/                 Maze is Life!


The problem is: When using COM objects, there's a difference between  
using single and double values.
If I can't send (the other library) doubles, I must send it single  
floats. But the library doesn't tell me it wants an array of doubles,  
it says it wants any COM object (but, if I send it an array of  
doubles, I get a COM exception), so I can't, in MysterX, decide to  
send it an array of single-floats whenever the user passes a vector of  
real numbers or every procedure that expects an array of doubles will  
fail.

What would be better is to create vectors and tell mysterx what type  
it's contents should be, but then it wouldn't be as transparent (right  
now, if mysterX receives a vector from the COM side, it marshals it to  
the Scheme side as a Scheme vector. We could remove that or setup  
another mechanism to create (and tag) vectors so they wouldn't be  
marshaled unless one wants to.

But I think, if you wanted to compile-in single float use, you should  
be able to create a Scheme vector with single or double floats and  
have it converted to a COM array with single or double floats. If you  
didn't compile single-float support, you would only have double-floats  
to pass to the COM side.

There are no solutions, only commitments, as my teachers say. ;-)


- Filipe Cabecinhas





Posted on the users mailing list.