Page 1 of 1

Operator malfunction

Posted: Fri May 13, 2022 4:57 pm
by dunbarx
I had a modest "switch" statement in a handler. All of a sudden, it stopped working, that is, none of the case statements would fire. I could see nothing wrong with it. So I inserted a "case" test just before the switch (pseudo):

Code: Select all

if xyz is "true" then beep

switch
  case xyz = "true" 
    beep
break
...
I got a beep, but only one, the first one. Stepping through, flow passed right past the switch.

The only way out, and I had no idea it would work, was to rewrite from scratch the original switch construction. I did, and after that, everything worked fine. I got two beeps.

And OK, I know the thread title is a pervasive, insidious issue. I have suffered from it forever. I am not asking for anything.

Craig

Re: Operator malfunction

Posted: Fri May 13, 2022 5:18 pm
by richmond62
I would hope that you kept your original code somewhere so
you can do a 'diff'.

As an expert at ballsing up code, while experience has not stopped from continuing to do that, it has taught me that there will be something that I overlooked.

Re: Operator malfunction

Posted: Fri May 13, 2022 7:04 pm
by dunbarx
Richmond.

Great minds think alike.

Exactly the same length. Reads the same. I suppose I should do something like:

Code: Select all

repeat with y = 1 to the length of oldSnippet
  if char y of oldSnippet <> char y of newSnippet then destroyComputer
Craig

Re: Operator malfunction

Posted: Fri May 13, 2022 7:50 pm
by richmond62
Well, I would not destroy the computer, but I would ask the code
to signal you directly.

Re: Operator malfunction

Posted: Fri May 13, 2022 11:31 pm
by dunbarx
Richmond.

That was my point. I did. The results were identical.

Craig

Re: Operator malfunction

Posted: Sat May 14, 2022 1:33 pm
by stam
Can I ask
- did the malfunction persist after quitting and restarting LC
- does the issue persist if you extract the relevant code to a new empty stack?

On rare occasions I found that some weird subsystem has crashed silently with no notification to the developer and the only symptom is that code that used to work and should work doesn’t.