Design of intuitive interfaces

Nick Sabalausky a at a.a
Sun Feb 21 12:06:13 PST 2010


"Jacob Carlborg" <doob at me.com> wrote in message 
news:hlrk2c$2kq7$2 at digitalmars.com...
> On 2/21/10 16:19, bearophile wrote:
>> Michel Fortin:
>>> array.sort(predicate)     // sort in place using predicate
>>> array.sorted(predicate)   // create sorted copy using predicate
>>> array.isSorted(predicate) // tell if the array is sorted using predicate
>>
>> Good.
>>
>> Another possibility is to let D2 accept ? and ! too inside variable 
>> names, so they can become (as in Ruby I think, and something similar is 
>> common in Lisp-like languages too):
>> array.sort(predicate)
>> array.sort!(predicate); // void function
>> array.sorted?(predicate)
>>
>> Bye,
>> bearophile
>
> I never liked that with ruby, I would prefer Michel Fortin's suggestion.

I'm surprised to hear that. I always thought it was very clean and more 
generally-useful than things like isBlah (I've frequently run into cases 
where the isBlah couldn't be used as it would have resulted in a gibberish 
variable name). Only problem I ever saw with it is that it's not a realistic 
possibility in D due to ambiguities with other parts of D's syntax.





More information about the Digitalmars-d mailing list