On Thu, May 6, 2010 at 12:54 PM, David Ashley <david.ashley....@gmail.com> wrote:
> The real problem with "generic" classes is that there are functions that > exist in an OS that just do not have an analog in other operating > systems. As an example, take printing. Yeah I see what you are saying David. I think you're example of printing is one where I would say there should not be a generic class, maybe. Also, I think down below, your wording suggests the solutions to some of the things you are pointing out. > As another example, here is a small list of things that the current File > class does not handle: > > 1. extended attributes > 2. file meta data that does not appear in Windows i.e. original creation > date, etc. > 3. symbolic links > 4. file range locking (locking a portion of a file) > > While I am not opposed to creating generic OS classes where there is > common functionality, we must come up with a way of extending the > classes in such a way that they can include OS specific functionality. Well, "extending" a class is sort of what OO is about. It seems to me that we could have a platform specific class that extends the File class for those situations where there is just no similar function. Rather than have a creatSymbolicLink() method in File, why not something like: /* file unixfile.cls' */ ::requires 'unixfile' LIBRARY ::class 'UnixFile' subclass File ::method createSymbolicLink external "LIBRARY unixfile unx_createSymbolicLink" Now, I might have the details quite right, but I think the basic idea is there. (Actually I don't remember if File is a builtin class or not.) So, the user writing a program that is intended to be cross-platform would just use File to delete, move, copy files etc. On the other hand, the person wanting to write a program specific to Linux and use symbolic links, would just put in a ::requires 'unixfile.cls' As for printing, I don't know printing well, but it seems there are a few commonalities. Like print this file on the default printer. Couldn't that work like rxmath where the dynamic library loaded is the one compiled for the operating system, and use the technique above. I.e., you have one file, maybe printer.cls /* printer.cls */ ::requires 'printer' Library ::class 'Printer' public ::method printFile external "LIBRARY printer prnt_printFile" On Linux you have printer.so and on Windows printer.dll. The implementation for prnt_printFile on Linux does what is needed, the implementation on Windows does what's needed. The method takes a string naming the file and prints it. On Windows you have another file. /* winPrinter.cls */ ::requires 'printer.cls' ::class winPrinter subclass Printer public ::method addDefaultPrinter external "LIBRARY winPrinter wprnt_addDefaultPrinter" In some generic cross-platform program where you just needed to write some stuff to a file and then print the file, your program would: ::requires 'printer.cls' On the other hand, on Windows where you needed more platform specific stuff, your program would: ::requires 'winPrinter.cls' The thing about printing though, is that most of it *is* platform specific, so maybe you are not likely to be able to write a generic program anyway. Then if you are writing a Linux specific program, you would just do: ::requires 'linuxPrinter.cls' -- Mark Miesfeld ------------------------------------------------------------------------------ _______________________________________________ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel