[Issue 4475] Improving the compiler 'in' associative array can return just a bool

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 7 07:18:55 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=4475



--- Comment #6 from bearophile_hugs at eml.cc 2012-01-07 07:18:55 PST ---
(In reply to comment #4)
> I would be against making 'in' return bool for AAs. I often do:
> 
> if (auto x = foo in someAA)
>     // do something with *x
> 
> Doing a lookup after checking for foo's presence in someAA is ugly compared to
> this.

Ugly is returning a pointer in a language like D where pointers are usually not
necessary.

What's bad/ugly in code like this? I think it's more readable:

if (foo in someAA) {
    // do something with someAA[foo]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list