Hi, Rony

Missatge de Rony G. Flatscher <rony.flatsc...@wu.ac.at> del dia dt., 28 de
febr. 2023 a les 17:11:

> (snip)
>
> "package" represents at runtime the program in which an invocation
> currently executes and can be fetched using ".context~package".
>
> The .Package class' importedPackages method supplies the currently
> available "imported packages" as an array. Each "::requires someProgram"
> and each "call someOtherProgram" will cause entries to be added and access
> to all public classes and public routines of all such imported packages is
> maintained thereby.
>
Sorry, but if I am not mistaken, this is plain wrong. You can download a
test case here: https://www.dropbox.com/s/ne049xkbuwcpvy7/test.zip?dl=0

I'm copying the files below in case you prefer cut-and-paste. They are very
very small:

--- program.rex ---

Parse source . howcalled myself
Say myself "called, call type="howcalled


::Class C Public

::Constant K

----------

---- call.rex ---

Call program


say "say .context~package~importedpackages~items  -->"
.context~package~importedpackages~items

say "say .c                                       -->" .c

----------

--- requires.rex ---

say "say .context~package~importedpackages~items  -->"
.context~package~importedpackages~items
If .context~package~importedpackages~items > 0 Then
  Do counter i imported over .context~package~importedpackages
    Say "  "i":" imported~name
  End
say "say .c                                       -->" .c


::Requires program

----------

Output:

---------------------------

D:\test>*call.rex*
D:\test\program.rex called, call type=SUBROUTINE
say .context~package~importedpackages~items  --> 0
say .c                                       --> The C class


D:\test>*requires.rex*
D:\test\program.rex called, call type=REQUIRES
say .context~package~importedpackages~items  --> 1
  1: D:\test\program.rex
say .c                                       --> The C class


D:\test>

---------------------------

In the case of CALL, .context~package~importedpackages~items = 0, but in
the case of ::REQUIRES, say .context~package~importedpackages~items = 1. In
the case of CALL, there is no reference to the imported package, but the
reference to the C class still works.

Besides, this is also *undocumented*: rexxref 3.3 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". There's nothing about CALL in the description of ::CLASS, only
aabout ::REQUIRES (or in the description of ::ROUTINE, for that matter).

If I understand your reasoning correctly, you suggest that CALL and
> ::REQUIRES behave differently assuming that one can only CALL a procedure
> or a routine? If that is the case then this assumption is not correct.
>

Well it was not an assumption, it's what the docs say, if I have
interpreted them correctly :)

Now that I've tested it, I can see that the situation is quite more
complicated. Oh well :)

Cheers,

  Josep Maria

Cheers
>
> ---rony
>
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to