Mike Cowlishaw wrote: > > > There is a third path that one might consider, if it makes sense (in > > > particular, the package needs to have some kind of persistent > state, or > > > able to get at some from the Rexx implementation), and that is: > let the > > > user choose. > > > > > > APL (I think it was) does this: essentially when starting to write a > > > program using the package, you set a flag (to 0 or 1, perhaps) saying > > > whether to use 0-based or 1-based indexing, according to > preference. The > > > package then adjusts all indexes as requested. > > > > > > You still have to decide what the default should be (unless not > specifying > > > is an error), but that's a much easier (read: less stressful) > decision if > > > there's a way to override it. (I'd agree with Chip on what the > default > > > should be :-).) > > > > When I started reading this thread, APL's "index origin" came > > immediately to mind. But in this case I find a REXX "astonishment > > factor" -- not in its behaviour, but in that its author would agree > > with and even propose something I imagined would be shot down in > > moments. Instead, everyone seems to like it! > > > > APL started with a global index origin, settable only as an overall > > and external attribute of a workspace, and not capable of being set or > > interrogated by the running program. This soon changed, but I believe > > in most implementations it was/is still a global value not related to > > any concept of package, or at least not to any package smaller than > > the entire workspace. > > That's the difference in what I was proposing ... the changeable index > would be relate to and affect only to the particular package (for > which the documentation, we are told, uses 0-indexing). Definitely > not a global setting, and definitely not changing Rexx's inherent > indexing (in, for example, the built-in functions such as POS or WORD). > > I agree the latter would be disasterous ... In BSF4[oo]Rexx the addressing of Java arrays (0-based) is done 1-based by wrapping up Java array objects in ooRexx proxy array objects (which also gained a few of the ooRexx array methods like items, dimension etc.). This way Java array objects are in effect camouflaged as ooRexx arrays, which makes addressing Java array objects straightforward/easy for ooRexx programmers.
Otherwise no re-basing was necessary, such that the documentation of the Java methods can be applied 1:1 if excercised from ooRexx. (And if the documentation states that some argument to a method is 0-based, so be it.) ---rony
------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________ Oorexx-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/oorexx-devel
