guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About hash-table iterators


From: Roland Orre
Subject: Re: About hash-table iterators
Date: Tue, 27 Jan 2004 18:39:21 +0100

On Tue, 2004-01-27 at 17:07, Mikael Djurfeldt wrote:
> [Cross-posting to guile-devel]
> 
> Roland Orre <address@hidden> writes:
> 
> > The elements of a hash table I consider the handles, not the key and
> > the value as separate entities, therefore I don't consider the current
> > iterators hash-map and hash-for-each in guile 1.7 very useful and the
> > basic iterators I've used over the year, i.e iterating over the handles,
> > can not be constructed from them. To be able to implement my previous
> > functionality I had to copy and modify a few routines from hashtab.c to
> > be able to implement e.g
<snip>
> The design decision for hash-for-each and hash-map was to abstract
> away the handle's, which are lower-level details of the representation
> of the table, and, also, to promote a functional style of programming.

Yes, this is a good argument, although I like functional programming
style I'm far away from any purist here. Often I like the imperative
style of doing things because it's often more intuitive (at least for
me...). Although in the case with hash tables I consider the handle
keeping the value together as fundamental and is often using it this
way.

> However, we *do* support handles in another set of functions.
> (Unfortunately, the abstraction is not complete here.  If we pass out
> a handle object, we should have accessor and mutator functions for
> this object and not just presume that it is a pair!)

Yes you are right. This may save a lot of work in the long run...

> So, I'm inclined to support your idea of introducing
> hash-for-each-handle.

I'm very pleased by this (the less code to maintain in user space,
the better)

> I don't think we need to introduce hash-map-handles, though.
No, you are right, that is not necessary.

        Best regards
        Roland






reply via email to

[Prev in Thread] Current Thread [Next in Thread]