Any plans to support .sort in CTFE?
dsimcha
dsimcha at yahoo.com
Sun Jul 10 17:49:19 PDT 2011
On 7/10/2011 12:22 PM, Trass3r wrote:
> The builtin .sort property doesn't work so far: Error: _adSort cannot be
> interpreted at compile time, because it has no available source code
>
> algorithm's sort does neither: dmd: interpret.c:2680: Expression*
> BinExp::interpretAssignCommon(InterState*, CtfeGoal, Expression*
> (*)(Type*, Expression*, Expression*), int): Assertion `(newval->op ==
> TOKarrayliteral || newval->op == TOKassocarrayliteral || newval->op ==
> TOKstring || newval->op == TOKslice || newval->op == TOKnull)' failed.
>
> Any plans to support sorting?
IMHO .sort should just be deprecated and eventually removed, at least in
D2. It's slow (compared to std.algorithm, at least with the
optimizations that were added for 2.054), it's inflexible (because you
can't specify your own comparison function), and there's no good reason
for it to be builtin. Even the syntactic sugar issue is a non-issue now
with uniform function call syntax.
More information about the Digitalmars-d
mailing list