[nem-en] macro to define a new kind of member
Kamil Dworakowski
kamil.dworakowski at googlemail.com
Sat Feb 24 17:17:15 CET 2007
Kamil Skalski wrote:
> I don't really like how you hardcoded the logic of passing modifiers
> into a macro call.
Sorry :>
> I think it would be much better to even create a dummy member (field,
> method) without name instead:
>
> public pointcut bla () blu : bli ();
>
> --->
>
> [pointcut (bla () blu : bli ())]
> public __dummy : int;
A junk method will be created, but shouldn't cause any problems. It will
definitely make a clearer implementation.
After parsing modifiers we can parse top level extensions targeted at a
WithinClass, and if sth was actually eaten and parser is at the end of
the loose group, create a method with some unique name. This method will
be given this macro as a yet one more attribute. Or maybe even resign
from WithinClass target and gen this meth whenever all the loosegroup is
eaten after parsing top extensions. That would be very short indeed.
One problem is that ParseClassMember initially collects all the custom
attributes that are targeted at anything but parameter. Should they be
filtered out before the dummy method is created?
>
> This is much more elegant and could be probably more useful in other
> cases.
Some example of another case?
Kamil Dworakowski
More information about the devel-en
mailing list