Properties: .sort and .reverse
language_fan
foo at bar.com.invalid
Wed Jul 29 06:58:35 PDT 2009
Wed, 29 Jul 2009 11:46:53 +0000, Moritz Warning thusly wrote:
> On Tue, 28 Jul 2009 16:46:51 -0700, Bill Baxter wrote:
>
>> One more thing I'd like to mention regarding properties.
>>
>> It has long annoyed me that .sort and .reverse are functions, but
>> CANNOT be called like functions.
>> So even if I'd like to make a distinction between properties and
>> functions in my usage, I cannot with those two. We should fix that.
>>
>> I think they may both be headed for the chopping block, but if not we
>> should fix em.
>>
>> --bb
>
> They should go into a library.
> I wonder why they ended up in the language anyway..
The idea behind built-in features like AAs or arrays (and operations on
them) is that the compiler can use clever optimizations to make them
faster than equivalent library provided containers (similar things
happened years ago when records and ZF expressions were added to
languages).
Another fact is that if you have a built-in syntax for some containers,
it's rather easy to overload the syntax with for instance custom HashMaps
and TreeMaps and transparently replace the built-in ones with these - I'm
sure that there must be projects that take advantage of these properties
of D.
More information about the Digitalmars-d
mailing list