* Aristotle Pagaltzis ([EMAIL PROTECTED]) [081210 00:06]:
> * Mark Overmeer <[EMAIL PROTECTED]> [2008-12-08 21:20]:
> > A pitty that we do not focus on the general concept of OS
> > abstraction (knowing that some problems are only partially
> > solvable (on the moment)).
> 
> Well go on. Explain how you would, f.ex., provide an abstract
> API over file ownership and access permissions between Win32
> and Unix? I don’t see such a thing being possible at all: there
> are too many differences with pervasive consequences. The most
> you can reasonably do (AFAICT) is map Win32-style owner/access
> info to a Unix-style API for reading only.

(I do not have time today for long emails... paying work to do :-(
The short answer:

Just like Path::Class or IO::File, I suggest an OO interface.  That
means that you may share methods between different OSes but it also
may not be possible.

Within this OO interface, you could design two abstraction levels:
one which maps directly to the OS calls, like supports "chown" via some
POSIX mix-in.  On an other level, we attempt to unify environments. For
the latter, you can think of methods like "owner" getter and setter,
"os_family" or "size".

Even more to my likings is an additional super-level.  In this case,
the actual platform-dependent implementation does its best... Maybe
something like:  (still Perl5 style)

   $file->change_attributes(owner => $user, group => $group,
      readable => 1, ...);

The core implementation tries as good and as bad as it goes to unify
various kinds of attributes onto OS specific features, taking care
of nastiness like change-order limitations.  Typically becoming smarter
over time.  Real DWIMming, exploiting our joint knowledge and share this.
-- 
Regards,
               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       [EMAIL PROTECTED]                          [EMAIL PROTECTED]
http://Mark.Overmeer.net                   http://solutions.overmeer.net

Reply via email to