Well, routines are really useful to for passing around "function pointers" or doing dynamic calls. For example, the old problem of doing a variable based functions. For example,
::method init expose variableRoutines // create a directory with the set of locally defined routines variableRoutines = .context~package~routines ::method callit expose variableRoutines use arg functionName say variableRoutines[functionName]~callWith(arg(2, 'A')) The package class allows you to examine/access code for your own or other packages. Some useful functions include what is essentially equivalent to a conditional ::requires or conditionally load native libraries to see if they're available. Rick On Thu, Apr 23, 2009 at 2:28 PM, Gil Barmwater <[email protected]> wrote: > Thanks Rick. Glad I didn't miss something here. BTW, I used the > 'forward' to limit the appearance of the value to a single spot, even > though it incurs a performance hit. > > Next question: are there any good examples of using the .package and > .routine classes? I'm a bit fuzzy as to when I would use them. I > suspect there are testunits - haven't had time to wade through SVN > looking for them - but do they show where one might use these classes as > opposed to the mechanics of how they work? > > Rick McGuire wrote: >> Nope, that's pretty much the picture, though from a strict correctness >> standpoint, it would really be: >> >> >>>::class golden >>> >>>::method phi class unguarded >>> return 1.618 >>> >>>::method phi unguarded >>> return 1.618 >> >> >> The instance one does not forward to the class one, but has it's own >> version of the same method object. >> >> Rick >> >> >> On Thu, Apr 23, 2009 at 1:14 PM, Gil Barmwater <[email protected]> >> wrote: >> >>>I'm trying to make sure I fully understand the new features in 4.0.0 and >>>the first one I'm playing with is ::constant. I've read over the >>>documentation and tried to code the equivalent functionality in 3.2. >>>Here is what I came up with: >>> >>>If in 4.0.0 I write >>>::class golden >>> >>>::constant phi 1.618 >>> >>>then that should be the same as >>>::class golden >>> >>>::method phi class unguarded >>> return 1.618 >>> >>>::method phi unguarded >>> forward to (self~class) >>> >>>Is this correct or have I missed something? >>>-- >>>Gil Barmwater >>> >>>------------------------------------------------------------------------------ >>>Stay on top of everything new and different, both inside and >>>around Java (TM) technology - register by April 22, and save >>>$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. >>>300 plus technical and hands-on sessions. Register today. >>>Use priority code J9JMT32. http://p.sf.net/sfu/p >>>_______________________________________________ >>>Oorexx-devel mailing list >>>[email protected] >>>https://lists.sourceforge.net/lists/listinfo/oorexx-devel >>> >> >> >> ------------------------------------------------------------------------------ >> Stay on top of everything new and different, both inside and >> around Java (TM) technology - register by April 22, and save >> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. >> 300 plus technical and hands-on sessions. Register today. >> Use priority code J9JMT32. http://p.sf.net/sfu/p >> _______________________________________________ >> Oorexx-devel mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/oorexx-devel >> > > -- > Gil Barmwater > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensign option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Oorexx-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/oorexx-devel > ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Oorexx-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/oorexx-devel
