What's missing from Phobos for Orbit (package manager)
    Michel Fortin 
    michel.fortin at michelf.ca
       
    Thu Feb 14 04:31:07 PST 2013
    
    
  
On 2013-02-14 11:58:12 +0000, Jacob Carlborg <doob at me.com> said:
> On 2013-02-14 10:46, Walter Bright wrote:
> 
>> I don't understand why one would go around the horn to just check for
>> !empty.
> 
> I've tried to explain, it shows what the intention is.
> 
> Instead of "str.length == 0" I use "str.empty". Instead of "!str.empty" 
> I like to use "str.any".
> 
> It's not a big deal but I would need to change quite a lot of code if 
> "str.any" isn't allowed.
I'd agree it's more readable, but it does not do what I expect when I 
read it: to me 'any' sounds like an accessor that would take an item at 
an unspecified position in a container (likely the less costly to get); 
std.container defines 'removeAny' following that line. The correct name 
would be 'hasAny'.
In this case I think it'd be much better if the language just 
translated "if (str)" to something equivalent to "if (!str.empty)".
-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca/
    
    
More information about the Digitalmars-d
mailing list