explicit castable to bool for predicate restraints?

Jonathan M Davis jmdavisProg at gmx.com
Tue Dec 18 01:45:14 PST 2012


On Tuesday, December 18, 2012 10:23:18 monarch_dodra wrote:
> On Monday, 17 December 2012 at 23:40:19 UTC, Jonathan M Davis
> 
> wrote:
> > On Monday, December 17, 2012 10:23:45 monarch_dodra wrote:
> >> Opinions? Just want to know how which direction to take my
> >> future
> >> developments.
> > 
> > How about we just require that they all return bool? I see no
> > reason to
> > support anything else.
> > 
> > - Jonathan M Davis
> 
> That seems excessive to me. I think a lot of predicates,
> especially if they have C linkage, will return a (u)int whose
> values are just 0 or 1. I see no reason to not support this.

Then wrap them in a lambda. int is not a boolean value in D, and I really 
don't think that we should be treating it as such. No D functions should be 
returning int for a boolean value, and I would expect using C functions with 
std.algorithm to be quite rare.

- Jonathan m Davis


More information about the Digitalmars-d mailing list