@tmarks11
I named two internal subroutines identically so as to demonstrate the problem. The subroutines intended to be visible had different names, of course.

In mature software environments, people who trust each other exchange subroutines, often without the desire or competence, and sometimes without permission, to look into their innards. If the subroutines are not buggy or malign, there is no need to look inside them. That's been the key idea behind subroutines since, well, the days of Ada Lovelace.

It should be possible for mutually-trustful members of the gCode community to confidently exchange subroutines, or confidently to call multiple subroutines from an upper level program, without regard to the subroutines' internals. Now it isn't.

@ken strauss
Yes, they were in separate files.

My model of what is going on is that the phenomenon demonstrated here is another manifestation of PathPilot's non-separation of parsing and interpretation. If PP separated the two, invocation of a filed subroutine would presumably lead to that subroutine being parsed, identifying syntactic errors and (where possible) internal links. Then, the interpreter would be set loose on the output of the parse. Instead, we know that PP does no more parsing (not even lexical analysis) than it absolutely has to, so syntactic errors are discovered one at a time (or, depending on the data, never*), and the only scoping is that of non-underscore parameter names. The result here is that when an Oh-number referenced inside a filed subroutine has been seen by the interpreter in another subroutine, the interpreter has no way of knowing that the intended target of the reference is closer at hand.

The clean fix here would be to have Oh-numbers within filed subroutines scoped to their respective files. I can imagine some (dirty) code that would be broken by this, so this fix might not be politic for Tormach to implement. The less-clean fix (issuing a Duplicate Oh Number diagnostic) might be technically harder, depending on the implementation of the interpreter.

I will be putting together a Windows program to scan a collection of gCode subroutines to harvest a list of all the Oh-numbers in use.

* For example, PathPilot will only sometimes detect the syntactic error in
Code:
o 100 if [#5410 GT 0.5]
    G01 kjhkjh
o 100 endif