D dropped in favour of C# for PSP emulator

Peter Alexander peter.alexander.au at gmail.com
Mon May 14 03:01:06 PDT 2012


On Sunday, 13 May 2012 at 10:08:47 UTC, bearophile wrote:
> Andrei Alexandrescu:
>
>> assumeSorted(range).contains(object)
>>
>> is still one line, safer, and IMHO more self-explanatory.
>
> It's self-explanatory if the name there contains something like
> "binarySearch". Otherwise it is NOT self-explanatory, I can't
> assume it will use a binary search.
> So it's surely not intuitive.
>
> Bye,
> bearophile

100% agree with this.

How anyone can possibly think that using 
assumeSorted(r).contains(x) to do a binary search is more 
self-explanatory than just writing binarySearch(r, x) is beyond 
me. It's mind-boggling.

We have proof that it is not intuitive: the fact that people 
frequently ask how to do a binary search in std.algorithm. If it 
was intuitive, they wouldn't need to ask. If it was 
self-explanatory, it wouldn't need to be explicitly mentioned in 
the documentation. Needing documentation is precisely the 
opposite of self-explanatory.

Andrei, you are a reasonable person. What evidence would it take 
to convince you that this design for doing binary searches is bad?


More information about the Digitalmars-d mailing list