[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH 3/4] Remove ##sys#expand-home-path.

From: Mario Domenech Goulart
Subject: Re: [Chicken-hackers] [PATCH 3/4] Remove ##sys#expand-home-path.
Date: Mon, 18 Mar 2013 14:03:41 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Hi Felix,

On Mon, 18 Mar 2013 11:25:02 -0400 (EDT) Felix <address@hidden> wrote:

> From: Mario Domenech Goulart <address@hidden>
> Subject: Re: [Chicken-hackers] [PATCH 3/4] Remove ##sys#expand-home-path.
> Date: Mon, 18 Mar 2013 10:33:49 -0400
>> Making robust software in shell scripting languages is hard, and one of
>> the reasons it is hard is that shells perform a lot of "convenient"
>> operations behind our back.  They may be convenient for interactive use,
>> indeed, but for programs they usually imply handling corner cases that
>> the programmer ends up forgetting, leading to bugs that are hard to
>> reproduce, find and fix.
> Nicely spoken. But all that shellish convenience is something that you
> use every day without even noticing. You are so used to it that you
> don't even realize that it's there. I don't see a reason not to add or
> keep some convenience (we are talking abouta high-level language,
> after all). So I'd like to keep "~"-expansion, at least for "load",
> and probably others like "compile-file". The "$"-expansion is silly
> enough to be removed, I fully agree with that. It should also be
> clearly documented which operations provide the expansion and which
> do not. 
> What I like about chicken is that I have the low-level access and
> (sometimes) the performance of a systems language with the convenient
> and the power of a high-level language, and that is basically the
> reason I use it at all. Doing everything in the way that seems to be
> implied here by "clean" will make us end up with something like the
> SML Basis, which is conceptually bloated and mindblowingly boring at
> the same time.

I totally agree with you with regard to convenient features, as long as
they don't cause any unexpected behavior that may lead to harmful
consequences.  Unfortunately, automatic ~-expansion sounds like a
dangerous gotcha to me.

If we keep the ~-expansion, any safe code that use the filesystem API
will have to resort to tricks like 

  (operation (if (absolute-pathname? the-path)
                 (make-pathname (current-directory) the-path)))

to guard against input that would cause unintended expansions.  In the
end, we'd have just the opposite of convenience (obviously, _if_ you
_remember_ to use the trick to avoid expansions).

Note that you need to know that `absolute-pathname?' does not expand ~.

Maybe I'm too paranoid?  Or missing something?

Best wishes.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]