<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-6962294913398429126.post1842053874749242702..comments</id><updated>2008-07-24T06:19:54.111-07:00</updated><title type='text'>Comments on wickedcoolthoughts: .Net Type Safety</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://wickedcoolthoughts.blogspot.com/feeds/1842053874749242702/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6962294913398429126/1842053874749242702/comments/default'/><link rel='alternate' type='text/html' href='http://wickedcoolthoughts.blogspot.com/2008/03/net-type-safety.html'/><author><name>Aslam's Blog</name><uri>http://www.blogger.com/profile/07436503144903480817</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6962294913398429126.post-5226600629225783117</id><published>2008-07-24T06:19:00.000-07:00</published><updated>2008-07-24T06:19:00.000-07:00</updated><title type='text'>Ooppppppppssss!!! Aslam's code fragment is like "M...</title><content type='html'>Ooppppppppssss!!! Aslam's code fragment is like &lt;I&gt;"MyEnum e2 = MyEnum.First + 109"&lt;/I&gt; not &lt;I&gt;"int i2= MyEnum.First + 109"&lt;/I&gt;&lt;BR/&gt;&lt;BR/&gt;Mee too likes guarding enumerations as normal OO types! Language implementors are free using integral stuff as underlying storage, but shouldn't mess up its integrity!!! This is why exactly C# programmers should always be expecting something out of defined enumeration value list - e.g. no &lt;B&gt;switch-case&lt;/B&gt; without a &lt;B&gt;default&lt;/B&gt;!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6962294913398429126/1842053874749242702/comments/default/5226600629225783117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6962294913398429126/1842053874749242702/comments/default/5226600629225783117'/><link rel='alternate' type='text/html' href='http://wickedcoolthoughts.blogspot.com/2008/03/net-type-safety.html?showComment=1216905540000#c5226600629225783117' title=''/><author><name>Jamal Mavadat</name><uri>http://www.blogger.com/profile/16234548896627503751</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://wickedcoolthoughts.blogspot.com/2008/03/net-type-safety.html' ref='tag:blogger.com,1999:blog-6962294913398429126.post-1842053874749242702' source='http://www.blogger.com/feeds/6962294913398429126/posts/default/1842053874749242702' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6962294913398429126.post-8203075167972797474</id><published>2008-07-24T05:59:00.000-07:00</published><updated>2008-07-24T05:59:00.000-07:00</updated><title type='text'>As Nikolas said C# ternary operator does enforce w...</title><content type='html'>As Nikolas said C# ternary operator does enforce well-typed expression. I agree it's sometimes annoying but just think about more complicated scenarios like "nested ternary operators"?&lt;BR/&gt;&lt;BR/&gt;And in enumerations, I don't see how Aslam's code fragment compiles in C#? Throughout all my 8-9 .NET years I've been using explicit-cast operator treating enums as integers!!! Aslam are you sure it does compile with default vendor-supplied compiler settings? :-? Will be pleased if you keep us tuned! :)&lt;BR/&gt;&lt;BR/&gt;Also check my post here (not out of context): &lt;A HREF="http://blog.mavadat.net/2008/05/c-covariance-and-contravariance.html" REL="nofollow"&gt;http://blog.mavadat.net/2008/05/c-covariance-and-contravariance.html&lt;/A&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6962294913398429126/1842053874749242702/comments/default/8203075167972797474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6962294913398429126/1842053874749242702/comments/default/8203075167972797474'/><link rel='alternate' type='text/html' href='http://wickedcoolthoughts.blogspot.com/2008/03/net-type-safety.html?showComment=1216904340000#c8203075167972797474' title=''/><author><name>Jamal Mavadat</name><uri>http://www.blogger.com/profile/16234548896627503751</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://wickedcoolthoughts.blogspot.com/2008/03/net-type-safety.html' ref='tag:blogger.com,1999:blog-6962294913398429126.post-1842053874749242702' source='http://www.blogger.com/feeds/6962294913398429126/posts/default/1842053874749242702' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6962294913398429126.post-5693879522351582886</id><published>2008-03-31T01:45:00.000-07:00</published><updated>2008-03-31T01:45:00.000-07:00</updated><title type='text'>With the current .Net implementation of the ternar...</title><content type='html'>With the current .Net implementation of the ternary operator,  I cannot do what is supported by the if-else without an explicit cast&lt;BR/&gt;&lt;BR/&gt;&lt;I&gt;&lt;BR/&gt;Object SomeMethod(){&lt;BR/&gt;&lt;BR/&gt; if(need_a_cat)&lt;BR/&gt; &lt;BR/&gt;  return new Cat();&lt;BR/&gt;&lt;BR/&gt; else&lt;BR/&gt;  return new Computer();&lt;BR/&gt;&lt;BR/&gt;}&lt;BR/&gt;&lt;/I&gt;.&lt;BR/&gt;&lt;BR/&gt;Java has a slightly different implementation which would let you do the same thing as the if-else using the ternary operator, without any surprises.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6962294913398429126/1842053874749242702/comments/default/5693879522351582886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6962294913398429126/1842053874749242702/comments/default/5693879522351582886'/><link rel='alternate' type='text/html' href='http://wickedcoolthoughts.blogspot.com/2008/03/net-type-safety.html?showComment=1206953100000#c5693879522351582886' title=''/><author><name>Aslam's Blog</name><uri>http://www.blogger.com/profile/07436503144903480817</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='12679517629867847028'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://wickedcoolthoughts.blogspot.com/2008/03/net-type-safety.html' ref='tag:blogger.com,1999:blog-6962294913398429126.post-1842053874749242702' source='http://www.blogger.com/feeds/6962294913398429126/posts/default/1842053874749242702' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-6962294913398429126.post-1658053220604331411</id><published>2008-03-28T01:15:00.000-07:00</published><updated>2008-03-28T01:15:00.000-07:00</updated><title type='text'>The first part can be stated like this: every expr...</title><content type='html'>The first part can be stated like this: every expression must be well-typed. Why isn't there an exception for the ternary operator? The simple answer is: special cases are a bugger and who wants to deal with them. If you consider implementing it, though, you then have to consider that you can end up with an exponential tree by nesting ternary operators.&lt;BR/&gt;&lt;BR/&gt;This is far from insurmountable, as Haskell demonstrates... most languages have a very simple type system.&lt;BR/&gt;&lt;BR/&gt;In the case of enums, you have to remember that an enum type is dressing for an underlying integer type (int by default). So, the addition operator causes an implicit cast to int and then passes that in. This behavior is a throwback to C...</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6962294913398429126/1842053874749242702/comments/default/1658053220604331411'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6962294913398429126/1842053874749242702/comments/default/1658053220604331411'/><link rel='alternate' type='text/html' href='http://wickedcoolthoughts.blogspot.com/2008/03/net-type-safety.html?showComment=1206692100000#c1658053220604331411' title=''/><author><name>Nikolas Coukouma</name><uri>http://www.blogger.com/profile/02634761754375730159</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://wickedcoolthoughts.blogspot.com/2008/03/net-type-safety.html' ref='tag:blogger.com,1999:blog-6962294913398429126.post-1842053874749242702' source='http://www.blogger.com/feeds/6962294913398429126/posts/default/1842053874749242702' type='text/html'/></entry></feed>