recursive types work

Andy Wingo wingo at pobox.com
Wed Dec 29 06:48:03 PST 2004


Hi Havoc,

A few thoughts on your (most excellent) work:

On Wed, 2004-12-29 at 02:47 -0500, Havoc Pennington wrote:
>      recurse (ARRAY of ARRAY of BOOL)
>        recurse (ARRAY of BOOL)
>          write (BOOL)

Hm, this is a bit confusing to me on first read. To me, this reads
better as:

       recurse (ARRAY)
         recurse (ARRAY)
           write (BOOL)

I think the only sane way to make this work would be to store the point
of the first recursion, then for the final unrecurse(), scan the values
to see what the type signature should be.

This would work for other recursive types as well. It would be CPU
overhead, but not terribly much.

> Note the "if (array is not empty)"

How can you detect that the array is finished when you are reading? One
would assume this condition can be unified with the case of the null
array. Perhaps this would require a special nil value that is only seen
internally, to mark the end of the array. That way you can always look
and see what's inside an array, so you won't need two separate
conditionals.

Do you want patches for either of these?
-- 
Andy Wingo <wingo at pobox.com>
http://ambient.2y.net/wingo/


More information about the dbus mailing list