jackfirth / racket-disposable

An experimental Racket library providing an abstraction for values associated with external resources that allows automatic resource pooling, per-thread virtual construction, and monadic composition
Apache License 2.0
7 stars 0 forks source link

Add thunk disposable wrapper #105

Open jackfirth opened 7 years ago

jackfirth commented 7 years ago
(with-disposable ([make-foo (disposable/thunk foo-disp)])
  (define foo1 (make-foo))
  (define foo2 (make-foo)))

Given a disposable, it should be easy to allocate a thunk that allocates values on demand, with all allocated values cleaned up when the thunk is deallocated. Easy to do with #104.