digitalmars.D - Any plans to support .sort in CTFE?
- Trass3r (8/8) Jul 10 2011 The builtin .sort property doesn't work so far: Error: _adSort cannot be...
- bearophile (5/7) Jul 10 2011 I think .sort is going to be deprecated.
- Daniel Murphy (3/11) Jul 10 2011 .sort will probably be going away.
- dsimcha (7/15) Jul 10 2011 IMHO .sort should just be deprecated and eventually removed, at least in...
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?
Jul 10 2011
Trass3r:The builtin .sort property doesn't work so far: Error: _adSort cannot be interpreted at compile time, because it has no available source codeI think .sort is going to be deprecated. (The abilities of CTFE are growing, why don't you write a small CT sort for your purpose?) Bye, bearophile
Jul 10 2011
"Trass3r" <un known.com> wrote in message news:op.vyevsfd03ncmek enigma...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?.sort will probably be going away. std.algorithm.sort will likely work in ctfe by dmd 2.055
Jul 10 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.
Jul 10 2011