Re: [racket-dev] sharing cpointers between namespaces

2010-10-29 Thread Matthew Flatt
At Thu, 28 Oct 2010 14:46:30 -0700, John Clements wrote:
 Specifically, I moved the define-struct of cpointer into a module by itself, 
 called ffi/unsafe/cvector-def; that way, my tool.rkt file can require this 
 one-line module and attach it to the user's namespace using 'reset-console'.
 
 BUT: the cvector.rkt file wants to use protect-out to prevent others from 
 using make-cvector explicitly, and I'm not sure how to do this after moving 
 the structure definition into another file.

Did you use `protect-out' to export from the new file? That should be
all you need to do, unless I misunderstand.

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


[racket-dev] sharing cpointers between namespaces

2010-10-28 Thread John Clements
I've put together a fix for the inability to share FFI objects between user 
namespaces... but it has a catch.

Specifically, I moved the define-struct of cpointer into a module by itself, 
called ffi/unsafe/cvector-def; that way, my tool.rkt file can require this 
one-line module and attach it to the user's namespace using 'reset-console'.

BUT: the cvector.rkt file wants to use protect-out to prevent others from 
using make-cvector explicitly, and I'm not sure how to do this after moving the 
structure definition into another file.  Compilation complains:

module: cannot protect imported identifier with re-provide in: make-cvector

... which seems pretty reasonable; there's no way to guarantee that protection 
when the imported binding could be floating around freely.

I started trying to track down the various instances of make-cvector inside the 
cvector.rkt module, but then decided it would be easier for a proof-of-concept 
simply to remove the protection.  

Happily, this solves my problem, but leaves another. Is there some obvious way 
to recover the protection--after all, I certainly have no need for the user 
namespaces to call make-cvector--without bloating the startup again?

John



smime.p7s
Description: S/MIME cryptographic signature
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev