<div dir="ltr"><font face="courier new, monospace">I am attempting to write a macro to clean up the use of define-values/invoke-unit and finding some confusing behavior.</font><div><font face="courier new, monospace"><br></font></div>
<div><font face="courier new, monospace">My macros module is:</font></div><div><font face="courier new, monospace"><br></font></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font face="courier new, monospace">#lang racket</font></div>
</div><div><div><font face="courier new, monospace">(provide (all-defined-out))</font></div></div><div><div><font face="courier new, monospace"><br></font></div></div><div><div><font face="courier new, monospace">(define-signature dog^</font></div>
</div><div><div><font face="courier new, monospace"> (woof</font></div></div><div><div><font face="courier new, monospace"> bark))</font></div></div><div><div><font face="courier new, monospace"><br></font></div></div>
<div><div><font face="courier new, monospace">(define mutt@</font></div></div><div><div><font face="courier new, monospace"> (unit</font></div></div><div><div><font face="courier new, monospace"> (import)</font></div>
</div><div><div><font face="courier new, monospace"> (export dog^)</font></div></div><div><div><font face="courier new, monospace"> (define (woof) (printf "Wuf !!\n"))</font></div></div><div><div><font face="courier new, monospace"> (define (bark) (printf "RarRarRar !!\n"))))</font></div>
</div><div><div><font face="courier new, monospace"><br></font></div></div><div><div><font face="courier new, monospace">(define-syntax use-dog</font></div></div><div><div><font face="courier new, monospace"> (syntax-rules ()</font></div>
</div><div><div><font face="courier new, monospace"> ([_ dog-unit]</font></div></div><div><div><font face="courier new, monospace"> (define-values/invoke-unit dog-unit</font></div></div><div><div><font face="courier new, monospace"> (import)</font></div>
</div><div><div><font face="courier new, monospace"> (export dog^)))))</font></div></div></blockquote><font face="courier new, monospace"><br></font><div><font face="courier new, monospace">..and the module using it is:</font></div>
<div><font face="courier new, monospace"><br></font></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="courier new, monospace"><div>#lang racket</div></font></div><div><font face="courier new, monospace"><div>
(require "macros.rkt")</div></font></div><div><font face="courier new, monospace"><div><br></div></font></div><div><font face="courier new, monospace"><div>(define-values/invoke-unit mutt@</div></font></div><div>
<font face="courier new, monospace"><div> (import)</div></font></div><div><font face="courier new, monospace"><div> (export dog^))</div></font></div><div><font face="courier new, monospace"><div><br></div></font></div>
<div>
<font face="courier new, monospace"><div>(use-dog mutt@)</div></font></div><div><font face="courier new, monospace"><div><br></div></font></div><div><font face="courier new, monospace"><div>(woof)</div></font></div><div>
<font face="courier new, monospace"><div>
(woof)</div></font></div><div><font face="courier new, monospace"><div>(bark)</div></font></div><div><font face="courier new, monospace"><div>(woof)</div></font></div></blockquote><div><font face="courier new, monospace"><div>
<br></div><div>I am trying to make the "use-dog" macro expand to the equivalent define-values/invoke-unit form as shown.</div><div>If I comment out the define-value/invoke-unit form I get warning about unbound identifier woof - implying that the (use-dog dog^) form is not doing the job. Moreover, the second module as it stands does not give a warning about duplicate definitions for woof or bark (as it does if I duplicate the define-values/invoke-unit form) - further indicating the non-action of use-dog.</div>
<div><br></div><div>The macro stepper shows use-dog expand exactly as expected, but it then seems to be ignored without any warnings.</div><div><br></div><div>Is there something I am misunderstanding here, or is this a bug ?</div>
</font></div></div>