<HTML><BODY>I think that it is right thing. But it translates symbol to string in runtime.<br><br>In my opinion, it is better to use syntax-case and translate symbol to string when expanding macros.<br><br>For example:<br><br>(define (test)<br> (defxosd 123 : _int))<br><br>in your variant will fail when (test) will be runned. If you use syntax-case it will not be compiled at all.<br><br><br>Среда, 4 сентября 2013, 16:22 -06:00 от Kieron Hardy <kieron.hardy@gmail.com>:<br>
<blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;" class="mailru-blockquote">
        <div id="">
        
        
        
        
        
        
        
        
<div class="js-helper js-readmsg-msg">
        <style type="text/css"></style>
        <div id="style_13783335860000000991" class="mr_read__body">
                <base target="_self" href="https://e.mail.ru/">
                
                        <div id="style_13783335860000000991_BODY"><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>
</div>
                        <div>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br>
</div>
                
                <base target="_self" href="https://e.mail.ru/">
        </div>
        
</div>
</div>
</blockquote>
<br>
<br>--
<br>Roman Klochkov<br></BODY></HTML>