Maxim, There are a few tools that might accomplish what you want. To have scoped definitions available to a set of top-level definitions (i.e. those inside my-begin), use splicing-local from racket/splicing. To make a set of definitions available at one place, you could package them up as a unit and use define-values/invoke-unit, or as a package and use open-package, or as a module (separate from the one with my-begin) and use local-require. In all of these cases, the binding of those forms is unhygienic (you are binding names that are not given by the user of the my-begin macro), so you may have to do some direct manipulation of syntax objects to get the scope how you want it. I hope I've at least given you some useful starting places.
Carl Eastlund On Mon, Aug 22, 2011 at 10:04 AM, Maxim Romashchenko <m...@anahoret.com> wrote: > Hello. > > Thank you for your reply, Eli. > It looks like I need to state my question more clearly. > > The trick I'm looking for is how to create a quasi-begin form inside which > you can use all the other symbols defined in the module, while those symbols > are not imported into top-level. In fact the only thing added to the top > level is supposed to be the quasi-begin form itself. > > Best regards, Maxim. > > > On 2011-08-22 16:04, Eli Barzilay wrote: >> >> 50 minutes ago, Maxim Romashchenko wrote: >>> >>> --- my-module.rkt --- >>> #lang racket >>> (provide my-begin) >>> >>> (define foo >>> ... >>> --------------------- >> >> You could do this: >> >> #lang racket >> (provide (rename-out [begin my-begin])) >> >> and get what you want, >> >>> --- main.rkt --- >>> #lang racket >>> (require "my-module.rkt") >>> >>> (my-begin >>> (foo >>> ... >>> ----------------- >> >> but it's probably easier to do this instead here: >> >> #lang racket >> (require (rename-in racket [begin my-begin])) >> > _________________________________________________ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/users > > _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users