[nem-en] Lists and indexes
Michal Moskal
michal.moskal at gmail.com
Wed Feb 21 12:51:00 CET 2007
On 2/21/07, vc <vc at rsdn.ru> wrote:
> > Exactly - having indexer would encourage people to use it as it would
> > be constant time operation
>
> In my option such a methods should not be included in std lib.
You mean methods that encourage bad programming style? Then I agree -
people would generally think that methods denoted with operators (like
the indexer) are (give or take) constant time.
For example we already have a problem with:
foreach (x in list_of_strings)
res += x;
which has quadratic complexity, but people wouldn't expect it.
The same problem is with + operator on lists.
--
Michał
More information about the devel-en
mailing list