Page 1 of 1
Whither empty handlers?
Posted: Fri Jan 08, 2016 11:28 pm
by dunbarx
I did not know this. Not a big deal...
If you make a new button, and put this into its script
Code: Select all
on mouseUp
testNothing
end mouseUp
on testNothing
end testNothing
and set a breakpoint at the "on testEmpty" line, that breakpoint is not caught. Same with a function call. It does not matter if you have spaces in the, er, empty space. The handler does not really exist until at least one character is between the keywords?
Craig Newman
Re: Whither empty handlers?
Posted: Sat Jan 09, 2016 6:34 pm
by jacque
You can usually put a breakpoint at the "end" line though. Or you can type the word "breakpoint" in the empty line.
Re: Whither empty handlers?
Posted: Sat Jan 09, 2016 6:55 pm
by Klaus
I ususally refuse to ask this, but why would one do that?

Re: Whither empty handlers?
Posted: Sat Jan 09, 2016 8:43 pm
by jacque
Sometimes it lets you see the value of local variables without actually running any handlers, but that doesn't seem to work reliably. The only other case I can think of is if you have commented out the guts of a script and you want to see what hander called it. But there are other ways to do that too.
Re: Whither empty handlers?
Posted: Sat Jan 09, 2016 11:54 pm
by dunbarx
Klaus.
What Jacque said. A variation:
Code: Select all
on mouseUp
put random(999) into xx
findVarVal xx
end mouseUp
on findVarVal xx
-- what is xx?
end findVarVal
Commented lines are invisible as well, and that is actually how I discovered this silly thing. I just couldn't make a soft breakpoint fire.
Jacque. Insert a line that reads "breakpoint"? Why not just put in anything at all?

Also, why "end" works, but not the "on"? (but who cares?)
Klaus. Do you think I just make this stuff up?

As the three oldest LC'ers on the planet, we have to stick together
Re: Whither empty handlers?
Posted: Sun Jan 10, 2016 4:11 am
by jacque
Also, why "end" works, but not the "on"? (but who cares?)
I'm guessing the debugger can't work without knowing which handler it's in, and it can't know that until the declaration line executes.
Re: Whither empty handlers?
Posted: Sun Jan 10, 2016 6:18 am
by dunbarx
Jacque.
Hmmm.
But then how does it know which handler it is in anyway? In other words, what does following content have to do with it?
I don't think this warrants much anguish. It just was interesting for a second.
Craig
Re: Whither empty handlers?
Posted: Sun Jan 10, 2016 12:23 pm
by Klaus
Hi Craig,
Klaus. Do you think I just make this stuff up?

YES!
No, of course not, I never had the need for this kind of trick, so I couldn't imagine its meaning
As the three oldest LC'ers on the planet, we have to stick together
Ah, the old "solidarnosc" thingie, OK
Best
Klaus
Re: Whither empty handlers?
Posted: Sun Jan 10, 2016 6:43 pm
by jacque
dunbarx wrote:Jacque.
Hmmm.
But then how does it know which handler it is in anyway? In other words, what does following content have to do with it?
I don't think this warrants much anguish. It just was interesting for a second.
Craig
But I can't leave unresolved conversations alone. It's a compiler, it doesn't know anything until it's seen it. Same reason you have to declare script variables above any handler that uses them.
If we judge age by the number of posts then I think Klaus is the oldest.
