'Path' implementation
Brian T. Rice
water at tunes.org
Wed Sep 8 11:00:18 PDT 2004
Brian T. Rice wrote:
> Hi Pavel,
>> ***********************************************************************
>> I tried to use ({#a -> #b} as: Dictionary) idiom, but it did not work
>> - silently creating bogus dictionaries. I believe I can fix this (by
>> implementing special case of Dictionary WriteStream, I think), but I'm
>> not sure if this should work at all (conceptually).
>
> I think it's relevant idea, but there's obviously a missing method and
> whatever method is getting applied needs to be overridden at the very
> least. Silent failures (without even a comment on the method) like that
> should just not happen. I'll take a look.
On further consideration, the problem is that sequences are mappings, so
the keys are the indices and just get copied over like that, with the
association as a value. A way around this is to do:
addSlot: #x valued: Dictionary newEmpty.
x add: #a -> #b.
which is hardly convenient. addAll: has the same problem as as: there,
looking for keys and values automatically and using the sequence indices
for it.
HOWEVER, I note that Streams are effectively index-less sequences, so I
tried:
addSlot: #x valued: Dictionary newEmpty.
{#a -> #b. #c -> #d} reader >> x writer.
Which does what we obviously want. A single idiom for "a reader >> b
writer" should probably be made, but it might conflate too much if it
reused the >> selector. I'll think more on it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: water.vcf
Type: text/x-vcard
Size: 208 bytes
Desc: not available
Url : /archives/slate/attachments/20040908/f4118cd9/water.vcf
More information about the Slate
mailing list