This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Shell-style programming in Kawa


On Jan 27, 2014, at 10:46 AM, Per Bothner <per@bothner.com> wrote:

> On 01/25/2014 11:46 PM, Jamison Hope wrote:
>> Is there a way to make this do what I intend?
>> 
>> 	&`{ls &`{pwd}/..}
> 
> This still doesn't work, but I checked in fixes so the
> following works:
> 
>    &`{ls &[&`{pwd}]/..}
> as does:
>    &sh{ls &[&`{pwd}]/..}
> 
> I'll fix the simpler version soon.

Great, thanks.

> On 01/26/2014 03:25 PM, Per Bothner wrote:
> 
>> An alternative to to change the behavior of converting a Process
>> to a string to do the '\n'-stripping there instead.  I.e. have:
>>   (define str::string &`{echo foo bar})
>> bind "foo bar" to str. rather than "foo bar\n".
>> 
>> The latter (change the string conversion) may be a more useful
>> behavior; I have to mull it some more.  Reactions?
> 
> I decided this wasn't a good idea, even though it is probably simpler.
> The biggest concern is that converting to bytevector and then to
> string gives a different result than converting directly to string,
> which seems dubious.  Also, if we're stripping final newlines when
> converting to a string, this complicates pipes and other "streaming"
> contexts.

I was less sure about this, too.  The nearest thing to DWIM behavior
that I could think of would be to strip the final newline if the output
was a single line (i.e. that was the only \n in the string), otherwise
to leave it intact.  But that's probably still wrong half the time.
I agree that the string and bytevector representations should match.


--
Jamison Hope
The PTR Group
www.theptrgroup.com




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]