Shell-style programming in Kawa
Jamison Hope
jrh@theptrgroup.com
Mon Feb 3 21:12:00 GMT 2014
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
More information about the Kawa
mailing list