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.

--
Mark Miesfeld

------------------------------------------------------------------------------
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

Reply via email to