What is the rationale behind std.file.setAttributes ?

Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com> Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Sun Dec 29 04:20:38 PST 2013


On Sunday, 29 December 2013 at 11:01:05 UTC, Marco Leise wrote:
> Basic OS level file-system I/O support is useful on its own,
> especially in a systems programming language. You don't need
> to pull in a whole bunch of dependencies to read a text file.

Yes, it is useful to have good bindings for OS-level apis. 
However, Posix is no longer an adequate abstraction for 
cross-platform file systems. In the cloud or in clusters you 
mount network drives with other properties than a local drive.

It is much better to encourage a high-level interface for general 
file access. That encourage a more portable design for an 
application. That makes porting much easier. Porting software 
that assumes a local drive to the cloud is tedious.

You don't pull in whole bunch of dependencies. You include the 
modules you need and they share the same interface. That's a 
clean design.

The file module reminds me of Perl and old Php, that was ok in 
the 1990s, but it is the wrong way of creating a file system 
abstraction in 2014.

If you just want to read and write a file with a specific path 
there is no reason for using a non-portable interface. Encourage 
a portable interface and porting to the cloud becomes trivial: 
you just swap out the context-object.


More information about the Digitalmars-d mailing list