D dropped in favour of C# for PSP emulator

H. S. Teoh hsteoh at quickfur.ath.cx
Fri May 11 15:48:33 PDT 2012


On Sat, May 12, 2012 at 12:43:00AM +0200, Timon Gehr wrote:
> On 05/11/2012 10:29 PM, Jonathan M Davis wrote:
[...]
> >Except that it would break the generally expected algoritmic
> >complexity of in, so it'll never happen ( O(n) for arrays, whereas
> >the worst case that would be acceptable would be O(lg n) - e.g. what
> >a binary tree could achieve).
> >
> >- Jonathan M Davis
> 
> The main use case I see is replacing tedious
> 
> if(foo == 'a' || foo == 'b' || foo == 'c' || foo == 'd') { ... }
> 
> with
> 
> if(foo in "abcd") { .... }

I always use this idiom:

	if ("abcd".canFind(foo)) { ... }


T

-- 
It only takes one twig to burn down a forest.


More information about the Digitalmars-d mailing list