This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Shell-style programming in Kawa
- From: Jamison Hope <jrh at theptrgroup dot com>
- To: "kawa at sourceware dot org list" <kawa at sourceware dot org>
- Date: Mon, 3 Feb 2014 16:12:39 -0500
- Subject: Re: Shell-style programming in Kawa
- Authentication-results: sourceware.org; auth=none
- References: <52C4B518 dot 5080000 at bothner dot com> <A72FB562-9459-4C69-B346-A6C94DBD22C4 at theptrgroup dot com> <52E3772D dot 50804 at bothner dot com> <4A37A2F8-76B0-421D-AFCB-62AA1EE78468 at theptrgroup dot com> <9CF037C1-15CA-48B9-80E5-83EDF306017F at theptrgroup dot com> <52E92422 dot 60300 at bothner dot com> <1D587284-2FB5-4B05-AE4E-85718F43CC70 at theptrgroup dot com> <52EC1FB4 dot 6050008 at bothner dot com>
On Jan 31, 2014, at 5:12 PM, Per Bothner <per@bothner.com> wrote:
> On 01/29/2014 11:11 AM, Jamison Hope wrote:
>> We can go one further and do
>>
>> (set! (setter path-data)
>> (lambda ((p ::path) (s ::string))
>> ((setter path-bytes) p (gnu.lists.U8Vector (->String s):bytes))))
>>
>> and then
>> (set! &<{/tmp/newfile.txt} "test")
>
> That doesn't seem right. The path-data "getter" returns a Blob,
> which means it's "vague" as to whether it's a bytevector or a string.
> Thus the setter should IMO allow at least a bytevector (including
> a Blob) or a CharSequence. It might reasonably also allow a char[],
> or a byte[], or a List<CharSequence> (interpreted as a list of lines,
> with a newline added after each).
>
> The set of coercions should probably be consistent with
> RunProcess.getInputStreamFrom.
Yeah, my only intention was to whip up something fast that would let me pass a string and to remind myself why setters are cool (and that the setter of a procedure can be set dynamically).
--
Jamison Hope
The PTR Group
www.theptrgroup.com