Re: [racket-users] Equivalent of dynamic-wind post-thunk for with-handlers

2018-01-24 Thread Alexander McLin
On Wednesday, January 24, 2018 at 5:54:44 PM UTC-5, Alexis King wrote: > > Based on your question, why not just use dynamic-wind in combination > with with-handlers? Just keep in mind that the post-thunk could be > called multiple times if there is a continuation jump into value-thunk, > so you

Re: [racket-users] Equivalent of dynamic-wind post-thunk for with-handlers

2018-01-24 Thread Alexis King
Based on your question, why not just use dynamic-wind in combination with with-handlers? Just keep in mind that the post-thunk could be called multiple times if there is a continuation jump into value-thunk, so you should also wrap the whole thing with call-with-continuation-barrier if it’s importa

[racket-users] Equivalent of dynamic-wind post-thunk for with-handlers

2018-01-24 Thread Alexander McLin
I have a with-handlers expression which handles several exceptions appropriately and raises user-error exceptions, I have some additional code I'd like to be executed after the exception have been handled, analogous to dyanmic-wind's post-thunk argument or like the finally clause of a conventio

Re: [racket-users] Using ffi/unsafe/alloc

2018-01-24 Thread Matthew Flatt
I think I haven't run into this because `r` and `foo` are usually combined into one value that's more Rackety. Maybe `allocator` should have a `get-result` optional argument similar to `deallocator`. Meanwhile: ;; Not exported: (define-fooapi make_foo (_fun (foo : (_ptr o _foo)) ->

[racket-users] unsubscr...@googlegroups.com

2018-01-24 Thread Hans Schueren
unsubscr...@googlegroups.com -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.go

Re: [racket-users] Using ffi/unsafe/alloc

2018-01-24 Thread Dmitry Pavlov
Konrad, I would create a wrapper like this: (define-fooapi make-foo (_fun (foo : (_ptr o _foo)     -> (r : _int)     -> (if r (begin (register-finalizer-and-custodian-shutdown foo destroy-foo) foo)     (error "can not make foo"))) Regards, Dmitry On 01/2

[racket-users] Using ffi/unsafe/alloc

2018-01-24 Thread Konrad Hinsen
Hi everyone, I am working on an FFI which overall progresses well - the Racket FFI library is really a very nice tool to have. The one problem I couldn't solve yet is handling resource allocation. My use case is very similar to what allocator/deallocator are meant for, except that the alloca

Re: [racket-users] whither `splicing-parameterize`? or am I doing it wrong?

2018-01-24 Thread Ryan Culpepper
It might make sense to `(set! new-parameterization #f)` at the end so that the parameterization (and the values it holds) can be GC'd sooner when splicing-parameterize is used at top level or module level. Ryan On 1/24/18 6:00 AM, Alexis King wrote: Here is an implementation of a version of