[nem-en] Re: Macro proposal

Kamil Skalski kamil.skalski at gmail.com
Tue Jun 19 21:21:31 CEST 2007


2007/6/19, Elifant <elifantu at mail.ru>:
> Kamil Skalski пишет:
>
> >> my_func1(arg, another, fun () {
> >>    my_func2(arg, fun () {
> >>      ...
> >>    })
> >> })
> > You could also use short C#3-like lambdas:
> > my_func1(arg, another, x =>
> >     x + 1
> > )
>
> But there is still line with ')'. It isn't that bad, but indentation
> syntax is all about replacing
> braces by indentation, I think.
>
> >> macro @~~ (call, params ext_args: array[PExpr])
> >>      match (call)
> >>          | <[ $name (.. $args) ]> => <[ $name (.. $(args +
> >> List.FromArray(ext_args))) ]>
> >>          | _ => Message.FatalError("There must be function call to the
> >> left of ~~ macro")
> >
> > A little bit shorter:
> > macro @~~ (call, params ext_args: list[PExpr]) {
> >  match (call)
> >          | <[ $name (.. $args) ]> => <[ $name (.. $(args + ext_args)) ]>
> >         ...
> > }
>
> I tried this, but Nemerle fails to compile 'params' of type 'list'. Maybe my
> compiler is too old (I use one from Debian Etch).

Strange, I think this is with us a long time...

 macro Record (par : TypeBuilder, params options : list [PExpr])
{
}


-- 
Kamil Skalski
http://nazgul.omega.pl


More information about the devel-en mailing list