implementation of file-related modules

ketil+haskell at ii.uib.no ketil+haskell at ii.uib.no
Thu Oct 9 11:42:07 EDT 2003


Isaac Jones <ijones at syntaxpolice.org> writes:

> * Some languages have a means of building paths in a portable way.  It
>   would be nice if we had access a file separator (like "/" in unix
>   and "\" in windows).

If this is really necessary, I'd prefer it if it was taken care of
"under the hood".  FilePath could probably be a more complex data type
(instead of the current "String"), perhaps dealt with as a list/tuple
of components.

>     "path.separator" Path separator (for example, ":")

I assume this is used to separate different paths when packing them in
a string.  This seems very application dependent, I'm not sure I see
the utility of it.

>     "file.separator" File separator (for example, "/")

Necessary if you need to construct file paths as strings.  Let's try
to avoid a tangle of "...++System.FilePath.getFileSeparator++..."
constructs in code, though.

I think we either should standardize the string format, or design a
new data type with a simple interface to access it.  How are the
languages with more general facilities doing this?  How often is it
useful? 

>     "user.home"      User home directory
>     "user.name"	     User account name

Nice to have, I think.  Simple to get from the environment, but having
standard wrappers would probably be a good idea.

Make a module, (System.Info?) with the appropriate functions?

> * Another item that would be useful in the System.Directory class
>   would be some kind of config file path.

This would be application -- and installation -- dependent, I'm sure? 

>   On Debian, that would be "/etc", on some systems, it might tend to
>   be more often "/usr/local/etc".

I mean, if I compile an application myself, I use ./configure
--prefix=/usr/local, and want it to keep its system-wide config in
/usr/local/etc.  Installing from a .deb would put config in /etc,
installing in my home directory would do something else again.

>   User config files tend to be in ~/ and start with a dot whereas
>   system config files end up in /etc, and don't start with a dot.)

In sum, this isn't something to standardize in the language, let the
application writers decide for themselves.

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Libraries mailing list