Design of intuitive interfaces

Jacob Carlborg doob at me.com
Sun Feb 21 07:38:52 PST 2010


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.



More information about the Digitalmars-d mailing list