Safer casts

Yigal Chripun yigal100 at gmail.com
Tue May 13 01:37:23 PDT 2008


Janice Caron wrote:
> 2008/5/13 Yigal Chripun <yigal100 at gmail.com>:
>>  >     alias std.algorithm.sort!("b<a") sort_reverse;
>>  >     array.sort_reverse;
>>  >
>>  > Is that close enough?
>>
>>  I want this alias in the library.
> 
> It can't be in the library, because if it were in the library it would
> cause the template to instantiate. We don't want it to instantiate if
> it's not needed.
> 
> (Currently, an alias causes instantiation, even if the alias is not
> subsequently used. I don't like that behaviour, but that's how it is
> right now).

I don't like it either.
> 
> 
> 
>>  D needs to make it possible
>>  to overload built-in properties.
> 
> You can't overload something that isn't a class. Overloading requires
> inheritance.

either D should provide special treatment for this or it shoud use one
of the other options like removing the built-in sort.
Besides we are discussing changes to D, aren't we?

although I'm still not sure that parameterizing sort with an alias for
the delegate makes less instances than parameterizing sort with array
element type. could you explain and compare the two options in this
regard? (this of course doesn't take into account the string mixin
instances)
of course, this is secondary to the syntax issue for me.





More information about the Digitalmars-d mailing list