[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] add pathname-expand
From: |
Mario Domenech Goulart |
Subject: |
Re: [Chicken-hackers] [PATCH] add pathname-expand |
Date: |
Wed, 13 Nov 2013 13:05:55 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Hi Felix and all,
On Mon, 11 Nov 2013 09:36:54 +0100 (CET) Felix Winkelmann <address@hidden>
wrote:
> From: Mario Domenech Goulart <address@hidden>
> Subject: Re: [Chicken-hackers] [PATCH] add pathname-expand
> Date: Fri, 08 Nov 2013 22:50:47 +0000
>
>> Hi Felix and all,
>>
>> Sorry for taking so long to handle this issue. To be honest I'm a bit
>> lost at it (see comments and questions below).
>>
>> `pathname-expand' looks quite simple at the first sight, but it turns
>> into a can of worms when some corner cases come into play.
>
> Well, if it is such a can of worms, then perhaps it's not such a great
> thing to have, after all. There are so many special cases and platform
> dependencies, that it actually confuses more than it helps.
Getting rid of it is the simplest approach. There are other ones,
though. Here are some of them:
* move pathname-expand to an egg. From users standpoint, I think it
won't make a big difference between having pathname-expand in the core
or in an egg. It's something new anyway. Having it as an egg can
actually be a win in the end: it would be available to older chickens
(although it wouldn't do anything, since pathname expansion is
implicit). But at least applications wouldn't break on an "Unbound
variable: pathname-expand" error. If pathname-expand is in the core,
programs that use it will have a hard dependency on CHICKEN 4.9.0.
* make it simpler. Only expand ~/user. No ~user and no ~~whatever.
* to work around the issue "what to do when home cannot be determined",
an additional parameter to determine the default home directory (a
string) or behavior (a procedure). Example:
(define default-user-home-directory
(make-parameter "/"))
(define (pathname-expand path)
(if (home-is-defined?)
(do-expand path)
(if (procedure? (default-user-home-directory))
((default-user-home-directory) path)
(do-expand path (default-user-home-directory)))))
If default-user-home-directory can be a procedure, users may
decide what to do when no home is defined.
* combinations of the previous items.
Personally, I'd vote for leaving it out of the core and eventually
implement it as an egg, when we have a consensus on what it should do.
Best wishes.
Mario
--
http://parenteses.org/mario