<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">
>> > ,----[ Side Note, since you mentioned efficiency ]<br class="">
>> > | I originally wanted to uphold the principle that, “if it isn't O(1),<br class="">
>> you<br class="">
>> > | don't make it a property.” The implication is that on collections,<br class="">
>> > | “count” would be a method. That would include Array, for which<br class="">
>> counting<br class="">
>> > | the elements *is* O(1). Some people argued that:<br class="">
>> > |<br class="">
>> > | 1. The idea of writing “a.count()” instead of “a.count” to count the<br class="">
>> > | elements of an Array was absurd.<br class="">
>> > | 2. Programmers don't draw conclusions about efficiency based on whether<br class="">
>> > | something is a property.<br class="">
>> > | 3. The fact that Array would have an O(1) non-property that *could*<br class="">
>> have<br class="">
>> > | been a property (if it weren't for CollectionType conformance)<br class="">
>> > | undermines any communicative power that you might get from using<br class="">
>> this<br class="">
>> > | distinction to choose properties.<br class="">
>> > |<br class="">
>> > | 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. </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>