Two funny things in PanoramaX

Perhaps you think, as I did, that 2/30/19 is not a valid date. But, it turns out, that in PanoramaX 2/30/19 is equivalent to 3/2/19. Although 2/30/20 is equivalent to 3/1/20. So

datepattern(date("2/30/19"),"Month dd, yyyy") ==> March 2, 2019

but

datepattern(date("2/30/20"),"Month dd, yyyy") ==> March 1, 2020

and

datepattern(date("4/31/19"),"Month dd, yyyy") ==> May 1, 2019.

But exceeding 31 for day will return an error. For some legal purposes, one year after 2/29/16 will be March 1, 2017, and in other places will be February 28, 2017. Thanks, Wikipedia. But Panorama chooses March 1.

Another funny thing. You may find optionclick(), shiftclick(), and doublecick() useful but wish you had another such tool. Now you do. It turns out that when you hold down shift and option then click

shiftclick()+optionclick()=-2

and option- double-click can also work:

optionclick()+doubleclick()=-2

That trick was told to me by Bob McGarey.

You could also use

shiftclick() and optionclick() = true()

and for option-double-click

optionclick() and doubleclick() = true()

This date problem is more general – it can happen with any month with less than 31 days, not just February. That will not be a trivial fix, but it definitely should be fixed, so I have logged it.

That is a side effect of the way that Panorama handles boolean values as integer values internally. This trick would work in a lot of programming languages. However, I don’t recommend it, as you are relying on how Panorama’s internal implementation of booleans works. This will probably never change, but this certainly isn’t documented or supported, so you shouldn’t rely on it. Perhaps even more importantly, if someone else happens to encounter this code, they will have no idea what is going on. Occasionally it is necessary to rely on a trick like that, when I have to do something like that I will put a comment with exclamation points next to it explaining what is going on, and probably with the word HACK! in all caps. In this case it isn’t necessary at all, there is no advantage to it, so I suggest staying away from this technique. I’d go as far as removing it anywhere I encountered it.