Re: What is the rationale behind std.file.setAttributes ?

2014-01-19 Thread Jacob Carlborg
On 2013-12-29 11:36, Marco Leise wrote: Oh right, they have a hidden attribute as well. I guess if Phobos should expose the 'hidden' state of a file it should write to this attribute, but read both. E.g. for a file named ".hidden" you could do: attribs.hidden = false; and still assert(a

Re: What is the rationale behind std.file.setAttributes ?

2014-01-19 Thread Jacob Carlborg
On 2013-12-29 12:00, Marco Leise wrote: Are you hijacking this thread to ask for Google Cloud support? ;) Don't forget FTP, SSH, WebDAV, ... Implementing all of this can take quite some time and will result in something like the "Gnome virtual file-system". It might become so large that std.file

Re: What is the rationale behind std.file.setAttributes ?

2014-01-19 Thread Ola Fosheim Grøstad
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-

Re: What is the rationale behind std.file.setAttributes ?

2014-01-19 Thread Marco Leise
On Saturday, 28 December 2013 at 08:18:44 UTC, Jonathan M Davis wrote: > on it specifically. My main point was that some stuff in > std.file is system- > specific and that if it has to be, it's better to have it in > std.file as system- > specific rather than not having it at all just because it

Re: What is the rationale behind std.file.setAttributes ?

2013-12-29 Thread Ola Fosheim Grøstad
On Sunday, 29 December 2013 at 16:06:32 UTC, Andrei Alexandrescu wrote: I think we (and others) have done a fine job so far at abstracting away e.g. very different ways of figuring whether an entry is a directory on Windows vs. Posix. Now we're to throw all that away and go back to silex stones

Re: What is the rationale behind std.file.setAttributes ?

2013-12-29 Thread Andrei Alexandrescu
On 12/29/13 7:43 AM, "Ola Fosheim Grøstad" " wrote: On Sunday, 29 December 2013 at 15:05:31 UTC, Andrei Alexandrescu wrote: Well one question is what other successful designs could we use as precedent? I don't know of any successful unified APIs for regular/remote filesystems that also allow ful

Re: What is the rationale behind std.file.setAttributes ?

2013-12-29 Thread Ola Fosheim Grøstad
On Sunday, 29 December 2013 at 15:05:31 UTC, Andrei Alexandrescu wrote: Well one question is what other successful designs could we use as precedent? I don't know of any successful unified APIs for regular/remote filesystems that also allow full local file functionality. The closest abstraction

Re: What is the rationale behind std.file.setAttributes ?

2013-12-29 Thread Andrei Alexandrescu
On 12/29/13 4:20 AM, "Ola Fosheim Grøstad" " wrote: 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 fi

Re: What is the rationale behind std.file.setAttributes ?

2013-12-29 Thread Marco Leise
Am Sun, 29 Dec 2013 13:44:02 +0100 schrieb Jacob Carlborg : > On 2013-12-29 11:36, Marco Leise wrote: > > > Oh right, they have a hidden attribute as well. I guess if > > Phobos should expose the 'hidden' state of a file it should > > write to this attribute, but read both. E.g. for a file > > na

Re: What is the rationale behind std.file.setAttributes ?

2013-12-29 Thread Marco Leise
Am Sat, 28 Dec 2013 15:23:55 +0100 schrieb Jacob Carlborg : > On 2013-12-28 03:46, Marco Leise wrote: > > > Wait a second, what about *setting* attributes? Some difficult > > ones are: > > > > o toggling read-only (for whom? user, group, others?) > > o executable flag > > o hidden flag > > > > On

Re: What is the rationale behind std.file.setAttributes ?

2013-12-28 Thread Jacob Carlborg
On 2013-12-28 03:46, Marco Leise wrote: Wait a second, what about *setting* attributes? Some difficult ones are: o toggling read-only (for whom? user, group, others?) o executable flag o hidden flag On Windows 'executable' is implicit and based on the extension. On Posix 'hidden' is implicit f

Re: What is the rationale behind std.file.setAttributes ?

2013-12-28 Thread Ola Fosheim Grøstad
On Saturday, 28 December 2013 at 08:18:44 UTC, Jonathan M Davis wrote: on it specifically. My main point was that some stuff in std.file is system- specific and that if it has to be, it's better to have it in std.file as system- specific rather than not having it at all just because it couldn't

Re: What is the rationale behind std.file.setAttributes ?

2013-12-28 Thread Jonathan M Davis
On Saturday, December 28, 2013 07:21:28 Marco Leise wrote: > schrieb Jonathan M Davis : > > We need to try hard to make Phobos cross-platform and portable, but some > > stuff just can't be, and std.file already has some functions which fall > > in that category (e.g. anything symlink related or dea

Re: What is the rationale behind std.file.setAttributes ?

2013-12-27 Thread Marco Leise
Am Fri, 27 Dec 2013 22:12:37 -0800 schrieb Jonathan M Davis : > On Saturday, December 28, 2013 06:54:53 Marco Leise wrote: > > For Phobos we need portable solutions. But it is also clear that > > std.file.setAttributes cannot be replaced to 100% by a portable > > solution. The question is: Does po

Re: What is the rationale behind std.file.setAttributes ?

2013-12-27 Thread Jonathan M Davis
On Saturday, December 28, 2013 06:54:53 Marco Leise wrote: > For Phobos we need portable solutions. But it is also clear that > std.file.setAttributes cannot be replaced to 100% by a portable > solution. The question is: Does portable code _care_ about setting > each possible chmod flag or Windows

Re: What is the rationale behind std.file.setAttributes ?

2013-12-27 Thread Marco Leise
Am Sat, 28 Dec 2013 05:13:57 +0100 schrieb Martin Nowak : > On 12/28/2013 05:01 AM, Marco Leise wrote: > > Ok, so there is a compatibility field for the file attributes > > in a .zip file. So a .zip extractor has to version(Windows/Posix) > > anyway to check if the attributes for a given file are

Re: What is the rationale behind std.file.setAttributes ?

2013-12-27 Thread Martin Nowak
On 12/27/2013 12:12 PM, Marco Leise wrote: It is a coincidence that both Windows and POSIX use a 32-bit integer for file attributes, but not technically sound to confuse them in a public API. On Posix this should use mode_t instead which is 16-bit on some platforms.

Re: What is the rationale behind std.file.setAttributes ?

2013-12-27 Thread Martin Nowak
On 12/28/2013 05:01 AM, Marco Leise wrote: Ok, so there is a compatibility field for the file attributes in a .zip file. So a .zip extractor has to version(Windows/Posix) anyway to check if the attributes for a given file are compatible with the host OS. Couldn't SetFileAttributes and chmod be ca

Re: What is the rationale behind std.file.setAttributes ?

2013-12-27 Thread Marco Leise
Am Sat, 28 Dec 2013 04:44:30 +0100 schrieb Marco Leise : > Am Sat, 28 Dec 2013 03:50:45 +0100 > schrieb Martin Nowak : > > > On 12/27/2013 12:12 PM, Marco Leise wrote: > > > This is a case of the proverbial thin wrapper around a system > > > function, as public API of Phobos. Amongst the large se

Re: What is the rationale behind std.file.setAttributes ?

2013-12-27 Thread Marco Leise
Am Sat, 28 Dec 2013 03:50:45 +0100 schrieb Martin Nowak : > On 12/27/2013 12:12 PM, Marco Leise wrote: > > This is a case of the proverbial thin wrapper around a system > > function, as public API of Phobos. Amongst the large set of > > operating system abstractions, this one is somewhat deceiving

Re: What is the rationale behind std.file.setAttributes ?

2013-12-27 Thread Martin Nowak
On 12/27/2013 12:12 PM, Marco Leise wrote: This is a case of the proverbial thin wrapper around a system function, as public API of Phobos. Amongst the large set of operating system abstractions, this one is somewhat deceiving, because it looks the same on each platform, but the parameter has a d

Re: What is the rationale behind std.file.setAttributes ?

2013-12-27 Thread Marco Leise
Am Fri, 27 Dec 2013 09:04:39 -0800 schrieb Andrei Alexandrescu : > I picture two ways out of this: > > 1. Improve the DirEntry abstraction by e.g. allowing it to fetch > attributes only etc. > > 2. Define a ligthly structure FileAttributes structure that encapsulates > the integral and offers

Re: What is the rationale behind std.file.setAttributes ?

2013-12-27 Thread Andrei Alexandrescu
On 12/27/13 3:12 AM, Marco Leise wrote: I know that code is from Martin, and I don't mean this as pointing with the finger. There are code reviews, too. True. Once code is accepted it is owned by the team. This is a case of the proverbial thin wrapper around a system function, as public API o

What is the rationale behind std.file.setAttributes ?

2013-12-27 Thread Marco Leise
I know that code is from Martin, and I don't mean this as pointing with the finger. There are code reviews, too. This is a case of the proverbial thin wrapper around a system function, as public API of Phobos. Amongst the large set of operating system abstractions, this one is somewhat deceiving,