Re: FFI support for disjoint types

2011-01-30 Thread Ludovic Courtès
Hello! l...@gnu.org (Ludovic Courtès) writes: > (define-syntax define-wrapped-pointer-type > (lambda (stx) > (syntax-case stx () > ((_ pred wrap unwrap print) ;; hygiene >(with-syntax ((type-name (datum->syntax #'pred (gensym))) > (%wrap (datum->syntax

Re: FFI support for disjoint types

2010-11-21 Thread Ludovic Courtès
Hi, Andy Wingo writes: > On Thu 11 Nov 2010 17:24, l...@gnu.org (Ludovic Courtès) writes: > >> (define-wrapped-pointer-type class? >> wrap-class unwrap-class print-class) > > Looks great! Would be a great addition to system foreign. Though I realized that some people might want a similar thin

Re: FFI support for disjoint types

2010-11-20 Thread Andy Wingo
On Thu 11 Nov 2010 17:24, l...@gnu.org (Ludovic Courtès) writes: > (define-wrapped-pointer-type class? > wrap-class unwrap-class print-class) Looks great! Would be a great addition to system foreign. >(with-syntax ((type-name (datum->syntax #'pred (gensym))) > (%wr

FFI support for disjoint types

2010-11-11 Thread Ludovic Courtès
Hello! I’ve used the macro below in a couple of projects. It allows the creation of disjoint Scheme types for disjoint C pointer types, and takes care of preserving eq?-ness for equal C pointers. Example: --8<---cut here---start->8--- ;; Create a wrapped poin