sort by length of line (Weird)
Richard Gaskin
ambassador at fourthworld.com
Tue Dec 13 16:48:56 EST 2011
Mark Wieder wrote:
> Richard-
>
> Good points all. I'm not requesting that the sort command be smart
> enough to handle all situations, but this is enough of a confusing
> point that I think the engine could benefit from some extra smarts. A
> simple parsing optimization for cases like
>
> sort tVar by length(each)
>
> could insert the "numeric" specifier without problems. I may write a
> glx2 macro to do this, expecially since I don't ever expect to see
> action on enhancement requests. But the point of the request isn't to
> create a more elegant and streamlined language construct, it's to
> reduce user confusion and having to think too deeply about what's
> going on internally in the compiler rather than concentrating on the
> program being built.
I can appreciate the convenience and the seeming intuitiveness, but
since it introduces a "sometimes" rule for the sort command I feel it
risks hampering learnability even as it attempts to help it.
There are so many exceptions we need to remember already I tend to be
cautious about adding more.
My favorite is how the absence of a "purge" command requires us to use
"delete", but only for mainstacks since using it on a substack will
actually delete it from the file (for those who care about such trivia
there's a request for a purge command here:
<http://quality.runrev.com/show_bug.cgi?id=3932>)
Another is that some functions can be called as though they're
properties (without parens and preceded with "the"; e.g. "the windows"
vs. "windows()"), but not all functions can use that form (and why
property syntax is desirable for function calls at all has eluded me
since HyperTalk 1.0).
And then there are arrays, where with a variable you can use:
put "string" after ArrayThang["label"]
...but with a property you can't use:
put "string" after ArrayThang["label"] of tObject
...and must instead use:
get the ArrayThang["label"] of tObject
put "string" after it
set the ArrayThang["label"] of tObject to it
There are others, and they wind up consuming a fair amount of time when
I'm teaching someone LiveCode for the first time.
Exceptions require memorization, and with a language this broad it can
helpful to keep the rule set as small as practical.
--
Richard Gaskin
Fourth World
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
More information about the use-livecode
mailing list