14. macro RepeatCStyle(c as int): macro RepeatInline(c as int):
return [| body = RepeatInline.Body
for i in range($c): yieldAll body for i in range(c)
$(RepeatCStyle.Body)
|]
RepeatXxx 3:
print “Go”
int ___temp14 = 0; Console.WriteLine("Go");
while (___temp14 < 3) Console.WriteLine("Go");
{ Console.WriteLine("Go");
int i = ___temp14;
___temp14++;
Console.WriteLine("Go");
}
18. public class
TimestampAttribute(AbstractAstAttribute):
public override def Apply(node as Node):
c = node as ClassDefinition
now = DateTime.Now
m = [|
public def GetTimestamp():
return $(now.ToLocalTime().ToString())
|]
c.Members.Add(m) // a new member added to
// an existing class
19. •
•
– [Timestamp]
public class C:
public def constructor():
pass
•
– c = C()
print c.GetTimestamp()