Sort() bug: `ascending` defaults to false

Sort() is documented to sort in ascending order by default:

OPTIONAL INPUTS

ascending True for ascending or False for descending. Defaults to True.

The following Coda doc suggests that either the docs are wrong or Sort() has a bug. I’m inclined to bet for the latter, because intentionally defaulting ascending to false seems a little evil.

If you are going to use the sort parameters, you can’t skip the first one. When using no parameters it defaults to true(), but if you use parameters you can’t skip the first one. If you do, the sort functions sorts on the display column and ignores sortby:

I am not sure if I would see this as a bug, once you know, you know :-).

I admire the in-depth reverse engineering you must have done to work this out!

Surely this behaviour can’t be intentional though. I’ve never seen any other system or programming language offer optional named parameters with defaults and then require them to be specified or else it silently does something else.

If optional named parameters must be specified, then I would suggest that the bug is that the formula still “compiles” without errors.

I have been using Coda for a couple of years - and I am starting to understand the peculiarities. I am not saying I always agree, but these type of things are not worth it to annoy yourself over, at least, not for me. Every language has a couple of strange things or exceptions - so does Coda :grinning:

3 Likes

Just gonna bump this with a tangentially relevant Wikipedia topic. :innocent:

I appreciate that not everything is worth fighting for, but in the spirit of continuous improvement (and of the principle below), I felt I would have done a disservice not to raise this issue.