<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
&gt;&gt; &gt; ,----[ Side Note, since you mentioned efficiency ]<br class="">
&gt;&gt; &gt; | I originally wanted to uphold the principle that, “if it isn't O(1),<br class="">
&gt;&gt; you<br class="">
&gt;&gt; &gt; | don't make it a property.”&nbsp; The implication is that on collections,<br class="">
&gt;&gt; &gt; | “count” would be a method.&nbsp; That would include Array, for which<br class="">
&gt;&gt; counting<br class="">
&gt;&gt; &gt; | the elements *is* O(1).&nbsp; Some people argued that:<br class="">
&gt;&gt; &gt; |<br class="">
&gt;&gt; &gt; | 1. The idea of writing “a.count()” instead of “a.count” to count the<br class="">
&gt;&gt; &gt; |&nbsp; &nbsp; elements of an Array was absurd.<br class="">
&gt;&gt; &gt; | 2. Programmers don't draw conclusions about efficiency based on whether<br class="">
&gt;&gt; &gt; |&nbsp; &nbsp; something is a property.<br class="">
&gt;&gt; &gt; | 3. The fact that Array would have an O(1) non-property that *could*<br class="">
&gt;&gt; have<br class="">
&gt;&gt; &gt; |&nbsp; &nbsp; been a property (if it weren't for CollectionType conformance)<br class="">
&gt;&gt; &gt; |&nbsp; &nbsp; undermines any communicative power that you might get from using<br class="">
&gt;&gt; this<br class="">
&gt;&gt; &gt; |&nbsp; &nbsp; distinction to choose properties.<br class="">
&gt;&gt; &gt; |<br class="">
&gt;&gt; &gt; | I did not win that argument :-)<br class=""></blockquote></blockquote></div><br class=""><div class="">I strongly agree that properties imply O(1) and most programmers I’ve ever worked with make the same assumptions. Even if the documentation says otherwise, code like</div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">fibonacciNumbers.count</font></div><div class=""><br class=""></div><div class="">looks as if you’re accessing a c-style field ‘count’ and that implies (at least to me) that it is a near-costless operation. Some of the biggest design mistakes I’ve ever seen use properties that trigger time-consuming operations like database or network access.&nbsp;</div><div class=""><br class=""></div><div class="">And I don’t think having to use <font face="Menlo" class="">a.count()</font> is absurd. :-)</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>