Don wrote: > ... > > A question: in C#/Java, can you have annotations on function pointer and > delegate declarations? > > void foo( int delegate(int) pure dg) { > ... > } > What would this look like with annotations?
Well, Java doesn't HAVE delegates and C# doesn't (AFAIK) allow you to define them inline; they have a special declaration syntax that can't be used in an expression. C# would probably look something like: namespace Blech { [Pure] public delegate int Moo(int); public class Urk { public static void foo(Moo dg) { ... } } } > (The underlying question is, how do annotations interact with the type > system?) I don't think they form part of the type; they're just sort of attached to that particular declaration. >> To answer Don's point, there is nothing saying that the compiler can't >> read attributes and change its behavior. Of course, those would have >> to be builtin attributes. > > Yes, but then they're just keywords, with an @ in front. You'd just be > kidding yourself if you think you've reduced the keyword count. I suspect the reasoning goes like this: * I want attributes. Walter doesn't see the use. * Walter complains about adding keywords. * I can make keywords look like attributes, and then I get attributes! :P >> My opinion on removing existing keywords is -- don't. There's little >> to no gain. Let that ship sail, and concentrate on future keyword >> proposals. >> >> -Steve