On Fri, 28 Jan 2022 09:42:50 +0100, Erich Steinböck wrote:

>> save it, say, in .local
>Don't use .local, put it into a simply variable instead

Actually, if I want to add it to the current package, I don't have to
save it anyplace else, just:
  
  .context~package~addPublicRoutine(.Routine~newFile( etc.

>callwith('say log(2)')
>strictly speaking, callWith requires an Array as its argument
>cleaner and simpler would be to use call("say log(2)")

That's what I get for posting code that I don't even try because I can't
use it yet!  I got ~call confused with something else I had just used
that I expected to take an argument when it didn't.

>This works for me:
>try = .Routine~newFile(.File~searchPath("rexxtry.rex"), "PROGRAMSCOPE")

"PROGRAMSCOPE" (or any other specified context) is what I can't use yet
until I upgrade.  I was wondering if adding the routine to the current
package might avoid the need for it, but it doesn't.  I have a feeling I
went through this all before and that was the whole reason I learned and
forgot about .context~package in the first place.

Reading the doc for PROGRAMSCOPE makes it clear why adding the routine to
the package doesn't help, and why saving it in .local to reuse in another
program in the session might not be so useful.  Since the scope is set
when the routine is defined, to give it the scope of another program I'd
have to make a new copy of it in that program:

  rexxtry = .routine~new('rexxtry.rex', .rexxtry~source, 'PROGRAMSCOPE')

Weird that there's no method to expose the routine name, so it can't be
copied from one routine to the other along with the source.

¬R




_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to