On Thu, May 16, 2013 at 8:34 AM, Staffan Tylen <staffan.tylen@gmail.com> wrote:
I'm a bit confused about the scope of PRIVATE versus PUBLIC classes. In the ooRexx documentation under the ::CLASS directive it says:

If you specify the PUBLIC option, the class is visible beyond its containing Rexx program to any other program that references this program with a ::REQUIRES directive. (See ::REQUIRES.) If you do not specify the PUBLIC option, the class is visible only within its containing Rexx program

So if I compile the example below like this: REXXC a.cls ab.bin

file a.cls:
::CLASS A PUBLIC
::METHOD init
say 'Hello from A'
b=.b~new
::REQUIRES b.cls

file b.cls:
::CLASS B PRIVATE
::METHOD init
say 'Hello from B'

then I would consider the result ab.bin to be "a containing Rexx program", so that A can call B. Now, if I have:

Staffan,

You are misunderstanding here.  

Class B is private, it is not seen in any other file than b.cls.  If you require the b.cls file, that's fine.  But, any other file that requires b.cls will only see the public stuff in b.cls.  The other file will not see anything private in b.cls


file c.rex:
a=.a~new
::REQUIRES ab.bin

That IMHO should work, but it doesn't. I can see why c.rex should not be able to call B but there is an error when A tries to call B.

It's clear that I've misunderstood the expression "containing Rexx program", maybe this could be clarified a bit.

It seems pretty clear to me.  ;-)  How would you clarify it?

--
Mark Miesfeld