A few days ago I first found out about units and it seemed kind of nice. If I understand the motivation for units correctly I have been solving the same problem so far using closures
(define (pseudo-unit param1 param2)
(define (a-funtion) ...)
(define (another-function param) ...)
(define internal-state ...)
(values a-function another-function))
And this has been working ok but to be honest I would prefer it if my pseudo-unit
were a macro so that I could access param1
and param2
at phase 0 if they are available at the call-site. I found, however, that is a bit too much bookkeeping using define-syntax
and syntax-parse
(which is the only part of racket macrology that I half-way understand).
I was looking for advice on what might be a good way to approach this. Maybe this is a good time to get out of my comfort zone with respect to macros trying to get a better solution this?