sort by length of line (Weird)

Mark Wieder mwieder at ahsoftware.net
Tue Dec 13 14:41:42 EST 2011


Pete-

Tuesday, December 13, 2011, 10:05:05 AM, you wrote:

> I think Mark's point is specifically to do with the length function which
> can only return a numeric value.  The suggestion is that the sort command
> should be smart enough to know that and automatically use a numeric sort
> (unless overridden) since it's not possible for text data to be produced.
>  I assume the enhancement request applies to any function that is only
> capable of returning a numeric value used in a sort statement, kinda like
> your ADD example.

Yeah, that's pretty much the intent of the enhancement request. I can
eyeball the statement

sort tVar by length(each)

and realize that the length function returns numeric values *only*. I
think the engine should be smart enough to make this jump as well
during the compile optimization process.

The engine does do implicit string-to-numeric conversions. And the
optimization process already converts case statements and multiple ifs
into similar bytecode constructs. I'd like it to do optimization on
the sort statement when possible.

-- 
-Mark Wieder
 mwieder at ahsoftware.net





More information about the use-livecode mailing list