<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I haven’t dug deep enough into the TR code to know for sure, but I think the difference is that structs declare fundamentally <i class="">new</i> types, whereas inline type definitions only declare type aliases. Whether or not this is actually the problem is unclear—I don’t know TR well enough to answer that.</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 23, 2015, at 21:23, Alexander D. Knauth <<a href="mailto:alexander@knauth.org" class="">alexander@knauth.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=windows-1252" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">There’s a bug report about this here:</div><div class=""><a href="http://bugs.racket-lang.org/query/?cmd=view&pr=14524" class="">http://bugs.racket-lang.org/query/?cmd=view&pr=14524</a></div><div class="">Though I notice it gives a different error message now.</div><div class="">But why should structure type declarations being a module-wide construct?</div><div class="">Internal function definitions work, and internal type definitions work, so why shouldn’t internal structure definitions?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class="">On Jan 22, 2015, at 3:57 PM, Alexis King <<a href="mailto:lexi.lambda@gmail.com" class="">lexi.lambda@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite" class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div 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></div>_________________________<br class="">  Racket Developers list:<br class="">  <a href="http://lists.racket-lang.org/dev" class="">http://lists.racket-lang.org/dev</a><br class=""></blockquote></div><br class=""></div></div></blockquote></div><br class=""></body></html>