David, Unlike the respondents so far, I do have a strong opinion (to the surprise of no one, I'm sure). My conviction is based on philosophical grounds because all the other reasons are ephemeral, and you are about to cast something in stone.
If you are creating something to be used by a Rexx programmer, it should adhere to the Rexx Philosophy, if at all possible. The counter-arguments are good ones (or you wouldn't have a dilemma) but none of them justify abandoning a core principal of the language's design. Programmers of C (and all its derivatives) are the only people on the face of the Earth who see no reason for cardinal numbers to match their ordinals. Go into a fast-food restaurant and ask for a cheeseburger, a fish sandwich, fries, and an iced tea. Then tell them to add bacon to the first item and cancel the third. I doubt you'll be happy with your meal. Zero-based indices are an impediment to learning programming, a continual source of errors, and provide no value to the programmer. The fact that the compiler avoids one subtraction operation per index lookup is of no benefit to the programmer on whose behalf the tool is being created. As for the specific questions that have been posed: > C programmers who > have programmed to this interface in the past will be more comfortable > with the zero-based numbering system. But I also want to bring in those > C and Perl programmers into the Rexx arena and that means having them > get used to a one-based system. I fail to see how any human, surrounded by one-based lists in real life, would have to "get used to a one-based system", unless C and Perl programmers fail to fall into that category. It's a minor conceptual adjustment for them, versus the significant cognitive dissonance created by going the other direction. > Also, all the documentation and examples for the system I am interfacing > to ooRexx is for C and Perl programmers. Thus all those docs and > examples are zero-based meaning that translating the examples to Rexx > involves some updating of the source program number constants. This is a situation that could easily change. We have 'way too many examples of design constraints that were implemented due to temporary resource limitations that continue to constrain long after the limitations are lifted. Yes, it will take effort to "correct" the documentation for the Rexx implementation, but that is just a SMoEditing. The delta effort to change to one-based indices will probably be lost in the larger documentation effort anyway. At some point, the C/Perl programmers will still have their docs, the Rexx programmers will have theirs. The same thing applies to ooDialog, indeed the poster child for the way NOT to implement a C-based package in the Rexx environment. Again, such a fundamental design decision should not be based to the current (and mutable) condition of the documentation. At some point, there will be ample and sufficient ooDialog documentation for ooRexx. No doubt it will still differ from the Microsoft documentation in many ways other than the base of indices. The situation will be no different from converting OLE recorder generated VB code to the equivalent ooRexx. The other "pro" is that now ooDialog will do exactly what the human programmer expects. Special cases such as the meaning of a -1 index are already inconsistent and will need to be addressed and documented as the special cases they are. That is not a reason to abandon the sensibility of using human indices. You'll notice that I've consistently referred to "Rexx", not "ooRexx". It is important that there not be an ooRexx philosophy that differs from the Rexx Philosophy. It is that novel approach to program language design that allowed Rexx to be so widely accepted and still in use thirty years later. The further ooRexx strays from it, the less it has to offer programmers over other (non-human-oriented) programming languages like Perl (which is obviously oriented towards non-humans :-) or Python. Unfortunately, this raises the fundamental question of what does ooRexx offer the object-oriented programmer? It's easy to rattle off the benefits of Rexx, just read them from Mike's manifesto from the first chapter of TRL. Why exactly would a C(++), Perl, Python, Ruby, or Java programmer be interested in yet-another-OO language? What does ooRexx give you that is compelling? It does not appear that simply being "object oriented extensions to Rexx" has been the path to wide acceptance. Thank you for raising this issue. We seem to have long ago abandoned the Rexx principle of document, discuss, _then_ code. -Chip- On 1/9/10 18:24 Mark Miesfeld said: > On Sat, Jan 9, 2010 at 9:43 AM, David Ashley <[email protected]> > wrote: > >> I am working on an ooRexx interface to something that is normally >> programmed in C. Of course, C uses zero-based indexes for thing like >> memory, array positions, etc. My code could be architected to either >> carry this forward to the ooRexx interface when it calls the C functions >> or it could translate the zero-based numbers to the more user friendly >> (and Rexx default) one-based numbering system. > > This is a good topic and one I have thought about, but I am also of > two minds here. > > In ooDialog, it looks to me that they started out converting the > zero-based indexes to one-based, but then did not carry through with > that consistently with later code. Some of the earliest basic > controls, (combo box, edit, etc.) convert the underlying 0-based > indexes to 1-based indexes. Then 'newer' controls (list-view, etc.,) > retain the underlying 0-based indexes. > > That of course is the worst possible approach. Obviously you would > want one package to be consistent through out. So, I've thought > about, if I could redo the entire package, would it be best to retain > the underlying 0-based indexes, or use 1-based indexes through out. > > The main con to using 1-based indexes for ooDialog, as I see it, is > that the MSDN documentation is so much more complete. There is no way > that the ooDialog documentation can reproduce all that. So, it would > be ideal, I think, for the ooDialog doc to say this is a brief > overview, the ultimate documentation is MSDN. Especially with Google > and other search tools, it would be much easier for ooDialog > programmers to figure out how to use the dialogs and dialog controls > from doc and examples on the Internet. Which of course will always > use 0-based indexes. > > The pro of course is that Rexx uses 1-based indexes, so converting the > indexes would make things more consistent with Rexx itself. > > Another problem with converting to 1-based indexes, (which comes back > to documentation) in ooDialog is how to be consistent with special > values. Often a index of -1 indicates an error, but sometimes not. > Do you convert -1 to 0? Do you leave it at -1? There are places > where it is hard to be completely consistent, because the Windows API > is not always consistent. But, the MSDN documentation, usually > documents what is what with respect to indexes. So, in the this area, > it would nice to be able to say, whatever MSDN says is correct. You > can't do that if you are converting indexes. > > All in all, I'm not sure which would be best. But, for external > packages that provide a way to access and use a well known API, such > as the Win32 API, I'm learning towards it would be better to be able > to say the well known documentation on the API is the authority. On 1/9/10 17:43 David Ashley said: > > I am working on an ooRexx interface to something that is normally > programmed in C. Of course, C uses zero-based indexes for thing like > memory, array positions, etc. My code could be architected to either > carry this forward to the ooRexx interface when it calls the C functions > or it could translate the zero-based numbers to the more user friendly > (and Rexx default) one-based numbering system. > > I have mixed emotions on this. On the one hand I much prefer the > one-based system that Rexx uses. On the other hand, C programmers who > have programmed to this interface in the past will be more comfortable > with the zero-based numbering system. But I also want to bring in those > C and Perl programmers into the Rexx arena and that means having them > get used to a one-based system. > > Also, all the documentation and examples for the system I am interfacing > to ooRexx is for C and Perl programmers. Thus all those docs and > examples are zero-based meaning that translating the examples to Rexx > involves some updating of the source program number constants. > > So I really am of two minds about this. In the past I have always leaned > to making things easiest for the Rexx programmer but this case has made > me rethink that idea. I am now questioning my assumptions and I want > some other opinions before I proceed too far. ------------------------------------------------------------------------------ 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
