@lexikos and
@swagfag Sorry friends... I pulled my post down (since it was the last) to try to make it
shorter, but I didn't realize you were answering at the same time. The original post is below. You are correct, lexikos. It was a test class.
===============================
SOLVED. I wasn't trying to create baseless speculation -- sorry if that wasted your time. The entirety of the function is just about what I gave you, minus a dependent library function that never executes. Here's the
xl function in full:
Code: Select all
xl() { ;refresh global excel comobject
try return comobjtype(xl, 'iid') == 'Excel' ? xl : xl := comobjactive('excel.application') ;code fails at first pass HERE
;xmb('Excel application not running.') ;This functions exits thread with msgbox, but it's failing before it gets here.
}
I can paste this code into its own script and it works fine, so it's true that it's failing only in context. That's why I asked my question about namespaces. In context, it fails before it's ever called (first pass?). The script is 8000 lines of proprietary client code I can't paste here. It runs fine in a109. Here's the full error dialog (minus the OK button and title bar):
Code: Select all
Error: Not allowed as an output variable.
Specifically: xl
Line#
1960: }
1963: {
1964: (msg != '') ? mbx(msg) :0
1965: exit(cod)
1966: }
1968: {
1969: Try
---> 1969: Return comobjtype(xl, 'iid') == 'Excel' ? xl : xl := comobjactive('excel.application')
1970: msgbox('Excel application not running.')
1971: exit()
1973: }
1975: {
1977: {
1977: Return send('^1<100>^{tab}a!h{esc}')
1977: }
The program will exit.
Based on your answer about "classnames turned into constants", I've found the problem. So thank you for that. There was indeed an error, but the dialog didn't help me find it too well. There was an unused test class in the code with the name xl that in a109 must have been silently overwritten.
If I change your test code just slightly to the following:
Code: Select all
global xl := 0
class xl{
}
xl(*) {
try return comobjtype(xl, 'iid') == 'Excel' ? xl : xl := comobjactive('excel.application')
}
msgbox('done')
You can replicate the same error:
Code: Select all
Error: Not allowed as an output variable.
Specifically: xl
Line#
001: xl := 0
002: {
000: }
004: {
005: Try
---> 005: Return comobjtype(xl, 'iid') == 'Excel' ? xl : xl := comobjactive('excel.application')
006: }
007: msgbox('done')
008: Exit
The program will exit.
Maybe there's an opportunity for a better error message? Something about "attempting to overwrite a constant"? Maybe the error should trip when the class overwrites a super-global or when the global overwrites the class? (I can't remember if the class parse happens before super-globals.) Anyhow, I think you get the picture.
Thanks again for the help. My apologies for not isolating better in the first post.