[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] add pathname-expand
From: |
Felix Winkelmann |
Subject: |
Re: [Chicken-hackers] [PATCH] add pathname-expand |
Date: |
Thu, 14 Nov 2013 12:24:26 +0100 (CET) |
>>
>> 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.
Makes sense.
>
> * make it simpler. Only expand ~/user. No ~user and no ~~whatever.
Also makes sense.
>
> * 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.
Hm. One more option. I'm not sure if this isn't perhaps too much choice.
> 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.
Good idea.
felix