On Tue, Apr 12, 2016 at 9:25 AM, Yichao Yu <[email protected]> wrote:

> On Tue, Apr 12, 2016 at 9:18 AM, Cedric St-Jean <[email protected]>
> wrote:
> >
> >
> > On Tuesday, April 12, 2016 at 8:59:54 AM UTC-4, Yichao Yu wrote:
> >>
> >>
> >> Macros cannot be scope local (without major change of everything)
> >> since they are executed at compile time and doesn't know anything in
> >> the scope.
> >
> >
> > Local macros in Lisp are expanded at compile-time. They're useful inside
> > macro-expansions, eg.
> >
> > @define_model() begin
> >     @var x = 10   # @var is a local macro, whose expansion depends on the
> > @define_model arguments
> > end
> >
> > I don't see why Julia couldn't support that.
>
> I don't really know how it works in lisp but in julia a macro is just
> a function with a special name `@...` that can be called automatically
> called by the parser.
>

Same in Lisp


> Also note that macros are not expanded when passing to another macro
> so if that is what you want, you can search for macrocalls in the AST
> you get in the macro and replace them when expressions you want.
>

True, but that's a pretty gruesome task for arbitrary ASTs. I just googled
"code-walker Julia" and didn't get any results. macrolet is a lot cleaner.


>
> >
> >>
> >>
> >> >
> >> > Thanks.
> >> >
> >> > --
> >> > ELS'16 registration open! http://www.european-lisp-symposium.org
> >> >
> >> > Lisp, Jazz, Aïkido: http://www.didierverna.info
>

Reply via email to