Yaaaay !!!  

Posted by KB

YaaaaY! So, what the heck am i screaming about :)
Alright non-technical folks, am gonna disappoint you, this is purely a tech post.

So, there is this spec for partial methods in C# :
http://msdn.microsoft.com/en-us/library/wa80x488.aspx

And the very last line says:
You cannot make a delegate to a partial method.

Why:
Am not pretty sure of the reason behind this design decision, but one of my friend points out that the reason could be,

say you have a partial method declaration like partial void foo();
and a partial method implementation like
partial void foo()
{

}

Lets say now that you make a delegate to Foo, and after sometime, you may choose to remove the implementation from the code. So partial methods allow the impl to be removed and declaration to still be there. But still you'll have your delegate pointing to foo and it will result in a build failure for the project and may be they preferred not to encourage such confusions?

Alright, whats the big deal about it?
Well, have u tried creating a delegate to a partial method ever?
Darn it, it works! I mean the C#3.0 compiler shipped with Visual Studio 2008, accepts a delegate to a partial method.

Well its not a tricky bug or a gotcha in the C# compiler that i stumbled upon, but a mere non-adherence to the compiler spec(the ultimate authority).

I even thought it could be a documentation defect but turns out that its not so. Right now, the C# team is investigating this.

Anyway, finding a bug in the shipped C# compiler is something that i could scream about... so, YaaaaY !

This entry was posted on 11:26 PM and is filed under , . You can leave a response and follow any responses to this entry through the Subscribe to: Post Comments (Atom) .

9 comments

for all those C#/.NET braggarts ;)
http://snipurl.com/33ihr

ps: machi for your dynamic typing feature --> http://snipurl.com/33iie :P

For some standard reference,
here i quote, Herb Sutter himself saying that at http://herbsutter.wordpress.com/

var sb = new StringBuilder(256);
var e = new UTF8Encoding();
var md5 = new MD5CryptoServiceProvider();

It’s not dynamic typing, per se; C# is still very much a statically typed language. It’s more of a compiler trick, a baby step toward a world of Static Typing Where Possible, and Dynamic Typing When Needed.

EKS idhu, ivlo seeriyasaa idhukku technical reply ellaam panra ?? M$ gives you a little too much time off work ?? (for the uninitiated, pun intended) :D

dai, its 12.35am in the middle of the night and i just returned from work. Right now having dinner. Bloggin is a part of life, C# is life!

bug podaradhu dhaane namma pazhakkam? idhu enna pudhu ketta pazhakkam? :P nalla velai payale...eduthu mela vei (keep it up :P)

adei tekkie, mokkai mokkai link-aa kuduthu en-ya paduththare :P

shankoo, irunga ungalukku thirumbi C# la vela varum.. appo theriyum yaaru tekkie yaaru kokkie, edhu mokkai link edhu nalla link nu :D

bug podaradhu dhaane namma pazhakkam? idhu enna pudhu ketta pazhakkam?

inga yen thozhilayae maathitaanunga thala.. aprom solren.. aapline discaasion?

in case u got confused, 'techie' is the edu-name for mr. sriram murali. i was talking about his links :)