<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>&nbsp;&nbsp; (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 &lt;kieron.hardy@gmail.com&gt;:<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>&nbsp; (syntax-rules (:)<br>&nbsp;&nbsp;&nbsp; [(_ name : type ...)<br>
&nbsp;&nbsp;&nbsp;&nbsp; (define name<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (get-ffi-obj (regexp-replaces 'name '((#rx"-" "_") (#rx"[*?]$" "")))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; libxosd (_fun type ...)))]))<br><br></div>fails on execution, with:<br>
<br>regexp-replace*: contract violation<br>&nbsp; expected: (or/c string? bytes?)<br>&nbsp; given: 'xosd-create<br>&nbsp; argument position: 2nd<br>&nbsp; other arguments...:<br>&nbsp;&nbsp; #rx"-"<br>&nbsp;&nbsp; "_"<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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (get-ffi-obj (regexp-replaces 'name '((#rx"-" "_") (#rx"[*?]$" "")))<br>
<br>with:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (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>
&nbsp;&nbsp;Racket Users list:<br>
&nbsp;&nbsp;<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>