Design of intuitive interfaces
Michel Fortin
michel.fortin at michelf.com
Sun Feb 21 07:24:57 PST 2010
On 2010-02-21 10:19:06 -0500, bearophile <bearophileHUGS at lycos.com> said:
> 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)
Note that Ruby only accept this as a suffix, but yeah it's part of the
identifier.
And I'd love this, but the ! suffix is totally ambiguous with the
template instantiation syntax, and the ? suffix would be ambiguous in
the ternary operator "?:".
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list