I agree with you damien. This is the experience we are facing with pillar. Manipulating fileReference is what pillar is doing and this is bad.
In addition the API of FileSystem is missing operations using path such as copying a sub structure from a given level or path to another structure at a different path. On Fri, Mar 30, 2018 at 5:30 PM, Damien Pollet <[email protected]> wrote: > I understand that when you want to actually open and read/write files, you > have to resolve them in a filesystem and that's what a FileReference is for. > > But there are uses for file paths BEFORE you have a filesystem to resolve > them in. > > I was talking about a config file, in which some values are file names > (sometimes absolute paths, sometimes relative). In a config file the paths > are not resolved because the filesystem is not known; maybe I want to test > the config file parser, and I don't actually have the matching files, or > maybe they are in a memory filesystem. > > Maybe I'm reading a Zip archive and I'm specifying a member of the archive > (so the path does not point to an actual file on disk). > > Maybe I'm writing a command-line argument parser, and some arguments are > supposed to be file paths and I want to syntactically validate that aspect. > Or I want to ensure that an argument is relative and not absolute. Or the > argument is a relative path from an implicit origin (unspecified as far as > the commandline parser is concerned); because the origin will be determined > by application code. > > In all those use cases, using FileReferences is just incorrect, as we're not > talking about existing files, but about abstract places or navigation > instructions in a hypothetical filesystem. > > > On 30 March 2018 at 16:57, Alistair Grant <[email protected]> wrote: >> >> Hi Damien, >> >> On 30 March 2018 at 14:59, Damien Pollet <[email protected]> wrote: >> > The class Path from FileSystem is documented as private… but it should >> > be >> > public, shouldn't it? >> > >> > First hint is that it's named with a public name: (Path not >> > FileSystemPath). >> > >> > Then, consider the following use-case : if you have a file name in some >> > config file (.ini, .toml…) then that's really a Path, not a resolved >> > FileReference. >> >> The file name is implicitly attached to a file system, so it is >> resolved (using Pharo terminology). If you pass the path to a >> program, e.g. an editor, it has enough information to be able to open >> the file. >> >> In Unix, everything is mounted on the root file system, so there's no >> need to specify a file system. Pharo's model allows for multiple file >> systems, e.g. the disk, and multiple memory and zip file systems. >> >> Path's by themselves don't provide much functionality - you can't >> actually access the file or directory you think is represented by the >> path; you have to know which file system the path is attached to. >> >> It's the FileReference that associates the path and the file system, >> and provides all the public interface. >> >> HTH, >> Alistair >> >> >> > I'm not talking about RelativePath and AbsolutePath, those can be hidden >> > away since Path provides the factory and DSL methods. IMHO they should >> > still >> > be renamed to a more private name. >> > >> > -- >> > Damien Pollet >> > type less, do more [ | ] http://people.untyped.org/damien.pollet >> > > > > -- > Damien Pollet > type less, do more [ | ] http://people.untyped.org/damien.pollet
