On Jan 14, 2008 5:00 PM, John Cowan <[EMAIL PROTECTED]> 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


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to