<?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-5754664854663769426.post7632758931540235424..comments</id><updated>2008-11-29T15:59:12.058+01:00</updated><title type='text'>Comments on Crazy Pointer: PDC 2008: The Future of C# 4.0 (2/3)</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.crazypointer.com/feeds/7632758931540235424/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5754664854663769426/7632758931540235424/comments/default'/><link rel='alternate' type='text/html' href='http://www.crazypointer.com/2008/11/pdc-2008-future-of-c-40-23.html'/><author><name>Ricky</name><uri>http://www.blogger.com/profile/18324470751965509112</uri><email>rickysh@gmail.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5754664854663769426.post-5781698699494195892</id><published>2008-11-29T15:59:00.000+01:00</published><updated>2008-11-29T15:59:00.000+01:00</updated><title type='text'>Hombre, es que en ese caso IMHO sería un fallo en ...</title><content type='html'>Hombre, es que en ese caso IMHO sería un fallo en el diseño, porque tener dos métodos sobrecargados que hagan cosas distintas no creo que sea muy apropiado. &lt;BR/&gt;Además en ese caso lo que se podría hacer es simplemente no usar parámetros por defecto.&lt;BR/&gt;&lt;BR/&gt;De hecho si usas número variable de parámetros, que si han incluido (que yo sepa desde siempre pero al menos desde la v2.0) tienes un problema similar:&lt;BR/&gt;&lt;BR/&gt;public void miMetodoDeLaLeche(int a, params int[] b) {&lt;BR/&gt;// Código que hace una cosa&lt;BR/&gt;}&lt;BR/&gt;&lt;BR/&gt;public void miMetodoDeLaLeche(int a) {&lt;BR/&gt;// Código que hace otra cosa diferente&lt;BR/&gt;}&lt;BR/&gt;&lt;BR/&gt;Como los parámetros son opcionales, si haces &lt;BR/&gt;miMetodoDeLaLeche(5);&lt;BR/&gt;el compilador no sabe cual resolver.&lt;BR/&gt;&lt;BR/&gt;Supongo que copiaron a Java :P</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5754664854663769426/7632758931540235424/comments/default/5781698699494195892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5754664854663769426/7632758931540235424/comments/default/5781698699494195892'/><link rel='alternate' type='text/html' href='http://www.crazypointer.com/2008/11/pdc-2008-future-of-c-40-23.html?showComment=1227970740000#c5781698699494195892' title=''/><author><name>Ricky</name><uri>http://www.blogger.com/profile/18324470751965509112</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='10817153364417160719'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.crazypointer.com/2008/11/pdc-2008-future-of-c-40-23.html' ref='tag:blogger.com,1999:blog-5754664854663769426.post-7632758931540235424' source='http://www.blogger.com/feeds/5754664854663769426/posts/default/7632758931540235424' type='text/html'/></entry><entry><id>tag:blogger.com,1999:blog-5754664854663769426.post-8773115656398040336</id><published>2008-11-29T15:00:00.000+01:00</published><updated>2008-11-29T15:00:00.000+01:00</updated><title type='text'>Yo tengo mi teoría de por qué no añadieron esa car...</title><content type='html'>Yo tengo mi teoría de por qué no añadieron esa característica hasta ahora.&lt;BR/&gt;&lt;BR/&gt;Los parámetros por defecto facilitan la llamada a los métodos, pero impiden la sobrecarga en algunos casos.&lt;BR/&gt;&lt;BR/&gt;public void miMetodoDeLaLeche(int a, int b = 5) {&lt;BR/&gt;   // Código que hace una cosa&lt;BR/&gt;}&lt;BR/&gt;&lt;BR/&gt;public void miMetodoDeLaLeche(int a) {&lt;BR/&gt;   // Código que hace otra cosa diferente&lt;BR/&gt;}&lt;BR/&gt;&lt;BR/&gt;¿Cómo se diferencian estos dos casos si se invoca al primer método haciendo uso del parámetro por defecto? Habría que renombrar alguno de ellos. Ante la duda sobre cómo diseñar esa característica en las versiones de C# actuales, supongo que tiraron por lo más fácil (no incluir parámetros por defecto), o simplemente copiaron Java XD.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5754664854663769426/7632758931540235424/comments/default/8773115656398040336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5754664854663769426/7632758931540235424/comments/default/8773115656398040336'/><link rel='alternate' type='text/html' href='http://www.crazypointer.com/2008/11/pdc-2008-future-of-c-40-23.html?showComment=1227967200000#c8773115656398040336' title=''/><author><name>Zorro</name><uri>http://www.blogger.com/profile/12028030880955553436</uri><email>noreply@blogger.com</email></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.crazypointer.com/2008/11/pdc-2008-future-of-c-40-23.html' ref='tag:blogger.com,1999:blog-5754664854663769426.post-7632758931540235424' source='http://www.blogger.com/feeds/5754664854663769426/posts/default/7632758931540235424' type='text/html'/></entry></feed>