[Issue 8946] « any » function does not what it should do

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 4 04:11:12 PST 2012


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



--- Comment #10 from Dimitri Sabadie <dimitri.sabadie at gmail.com> 2012-11-04 04:11:05 PST ---
(In reply to comment #9)
> If there's a measurable difference in efficiency between calling find (and
> checking for empty) and reimplementing find inside of canFind or any, then
> maybe we'll look at making it so that canFind and any don't call find. But the
> overhead of that return is so small (especially in comparison to the algorithm
> itself), that I'd be surprised if that ever happened.

The difference is that no one expect D developpers — who know the phobos — want
to manipulate a range as return of a search function. An index would be okay
since it returns a logic value for a search concept, but seriously, why would
it return the range with all poped up values to find the object ? It’s clearly
weird, and D is the single langage to do such a thing. Also, wanting to
refactor all the world is clearly not a good idea. Sometimes, rewritting the
wheel to adapt it for a specific concept is faraway better than reusing a weird
code that makes the function weird. Moreover, any would be something like 3-4
lines of code… It’s really terrible. So you prefer to write it with just one
line and propose a weird interface. Clever.

-- 
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