chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Re: Adding (system->string) somewhere


From: Zbigniew
Subject: Re: [Chicken-users] Re: Adding (system->string) somewhere
Date: Mon, 14 Jan 2008 19:33:34 -0600

On Jan 14, 2008 5:00 PM, John Cowan <address@hidden> wrote:
> Ivan Shmakov scripsit:
> >       Believe me or not, but the POSIX Shell behaves exactly that way.

> Sensibly so: what you get is a newline-separated list of lines,
> with no random empty line at the end to confuse matters.

It is sensible for an impoverished language like the POSIX shell.  But
this discussion is about Chicken, and emulating backticks there is
unnecessary.  Even backticks in Perl don't chomp the result.    Plus,
when you switch to reading from a file instead of a command, now
you've suddenly got a trailing newline again.

> Well, the alternative is to return a Scheme list of newline-free
> lines.

Or to return the output verbatim, without deleting the trailing
newline, losing a little information and introducing an imbalance
between file and command input.  And, again, often you just want to
iterate over each line as they come in.

The point is that it is hard to agree on the desired behaviour of a
hypothetical system->string, and introducing an abstraction over such
simple code--to handle only a fraction of cases and save one
argument--doesn't buy you anything.

Zb




reply via email to

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