<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Simple enough. This works:<div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class="">#lang racket</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">(define (make-me-a-struct)</font></div><div class=""><font face="Courier" class=""> (struct foo ())</font></div><div class=""><font face="Courier" class=""> (foo))</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">(make-me-a-struct) ; => #<foo></font></div></div><div class=""><br class=""></div><div class="">This does not:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class="">#lang typed/racket</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">(define (make-me-a-struct)</font></div><div class=""><font face="Courier" class=""> (struct foo ())</font></div><div class=""><font face="Courier" class=""> (foo)) ; error: cannot apply a function with unknown arity</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">(make-me-a-struct)</font></div></div><div class=""><br class=""></div><div class="">This problem makes sense. Type declarations seem to be a module-wide construct, so a type that should be scoped to a single function doesn’t work. I’m running into this issue when trying to create an executable struct using <font face="Courier" class="">define-struct/exec</font> from within a macro, which doesn’t work due to this particular problem.</div><div class=""><br class=""></div><div class="">I can work around this in a variety of ways—I can extract this into an untyped module and use <font face="Courier" class="">require/typed</font>, I can use vectors to “fake” structs and provide an appropriate interface, etc. Still, I wonder if there are any plans to resolve this type of problem? Since it seems to be an issue with how TR handles types at its core, I’m not even sure how feasible it would be.</div></body></html>