Oops, sorry about interpreting your question wrong. Unfortunately I don't know the answer to your actual question.
On Sat, Jan 2, 2021, 10:24 PM Sage Gerard <[email protected]> wrote: > I know about that. I asked why it was designed that way. > > > Sent from ProtonMail mobile > > > > -------- Original Message -------- > On Jan 3, 2021, 12:18 AM, Michael MacLeod < [email protected]> > wrote: > > > There's an edge case of 'module' when only one form is provided which > results in that form being partially expanded to determine if such > expansion would lead to a #%plain-module-begin form. Otherwise (more than > one form provided) they are wrapped in #%module-begin with no partial > expansion occurring. > > I think this might be causing the discrepancy you witnessed. > > From the docs (https://docs.racket-lang.org/reference/module.html): > > If a single form is provided, then it is partially expanded in a > module-begin context. If the expansion leads to #%plain-module-begin, then > the body of the #%plain-module-begin is the body of the module. If partial > expansion leads to any other primitive form, then the form is wrapped with > #%module-begin using the lexical context of the module body; this > identifier must be bound by the initial module-path import, and its > expansion must produce a #%plain-module-begin to supply the module body. > Finally, if multiple forms are provided, they are wrapped with > #%module-begin, as in the case where a single form does not expand to > #%plain-module-begin. > > (This response was adapted from one of my earlier replies to the mailing > list. Search racket-users for "perplexed by macro-expansion behavior near > #%module-begin" for more context). > > Best, > Michael > > On Sat, Jan 2, 2021 at 8:26 PM Sage Gerard <[email protected]> wrote: > >> Why does Racket handle modules with exactly one form differently? >> >> I ran into a bug where modules in my module language won't expand if the >> modules have exactly one form, so I'm just curious. >> >> (Wild guess: It's Racket's way of checking for a shortcut to end >> expansion earlier) >> >> *~slg* >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Racket Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/racket-users/OVvZ0OK4_PfyvXCWfuvzDWBM5-ellmDvNmWchVmsCwAJb_rbSZkCkyraakcGsEMSCl2BsLsWtMXFhQcXY75IKhYiYYGQQEI7lVXLgGBbTCc%3D%40sagegerard.com >> <https://groups.google.com/d/msgid/racket-users/OVvZ0OK4_PfyvXCWfuvzDWBM5-ellmDvNmWchVmsCwAJb_rbSZkCkyraakcGsEMSCl2BsLsWtMXFhQcXY75IKhYiYYGQQEI7lVXLgGBbTCc%3D%40sagegerard.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CACehHmBvs5KK4vQmwio93D1NZ9hTOoSv-Qkm8XOjF%2B4JWDOiHg%40mail.gmail.com.

