[plt-scheme] boxes?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Jan 23 18:59:47 EST 2007

If your method goes down into the dungeons of C/C++ (which is where  
the gui infrastructure lives), it will encounter methods that want to  
return multiple results. Well, in C you can't do this easily  
(allocate a struct, write in the results, return the pointer, ...) so  
people instead pass in several pointers to which the method can write  
results. At some places, the Scheme code reifies this kind of non- 
sense to the Scheme level because it was easy to do so for now, and  
later never arrived.

-- Matthias






On Jan 23, 2007, at 6:51 PM, Stephen De Gabrielle wrote:

> Hi,
>
> I'm trying to work out boxes;
>
> the MzScheme manual calls them 'records that have a single  
> field'  [3.11]
>
> I think I have a handle on how to use them - at least my attempts with
> the 'get-position' method seem to have worked.
>
> I'm just not sure what the advantage is?
>
> Any clues appreciated.
>
> Cheers,
>
> Stephen De Gabrielle
>
>
> --
> (define start (box 2))
> (define end (box 10))
> (send text-editor get-position start end)
> --
>> (send text-editor get-position start end)
>> start
> #&76
>> end
> #&86
>> (unbox start)
> 76
>>
>
>
> -- 
> --
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.