<div dir="ltr"><div><div><div><div>In trying to use the ffi example interface to the xosd program (xosd.rkt/use-xosd.rkt at ), I notice that <br><br>(define-syntax defxosd<br> (syntax-rules (:)<br> [(_ name : type ...)<br>
(define name<br> (get-ffi-obj (regexp-replaces 'name '((#rx"-" "_") (#rx"[*?]$" "")))<br> libxosd (_fun type ...)))]))<br><br></div>fails on execution, with:<br>
<br>regexp-replace*: contract violation<br> expected: (or/c string? bytes?)<br> given: 'xosd-create<br> argument position: 2nd<br> other arguments...:<br> #rx"-"<br> "_"<br><br></div>It appears Racket is now more strict, and perhaps what used to work now doesn't. <br>
<br></div>I naively fixed the immediate problem by using the ~a form (from racket/format) to convert the constant formed with 'name to a string, i.e, replace:<br><br> (get-ffi-obj (regexp-replaces 'name '((#rx"-" "_") (#rx"[*?]$" "")))<br>
<br>with:<br><br> (get-ffi-obj (regexp-replaces (~a 'name) '((#rx"-" "_") (#rx"[*?]$" "")))<br><br></div><div>Was this the right thing to do, or is there a better way?<br>
<br></div><div>Cheers,<br><br>Kieron.<br></div></div>