On Tue, Feb 12, 2013 at 2:51 PM, Staffan Tylen <staffan.ty...@gmail.com>wrote:

> I'm fiddling with the .Package class and have found that if I create a new
> package from an array of rexx code, the new package is immediately executed
> by the init method. Is this the way it is supposed to work? Example:
>
> a=.array~new
> a~append("say 'hi this is me'")
> a~append("say 'bye'")
> p=.package~new("package1",a)
>
>
I haven't played with the .Package class much, but it says this in the doc:

The files loaded by ::REQUIRES are also contained in Package class
instances.

So, I think that p = .Package~new()

is going to behave like:

::requires 'p.txt'

and if p.txt is

say 'hi this is me'
say 'bye'

Then when you require p.txt those 2 lines of code are going to run.  Which
is what happens in your test.  Change your test to this

a=.array~new
a~append("::routine speak public")
a~append("say 'hi this is me'")
a~append("say 'bye'")
a~append("return 0")
p=.package~new("package1",a)
r = speak()

and try it.

Although I just did and it didn't work as I expected.  But, it is more like
what I think should work.

--
Mark Miesfeld
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to