This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: Unifying properties
Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:
> Speaking as the originator of all current properties except symbol
> properties:
>
> I don't think properties belong in Guile at all.
>
> Properties don't have lexical scope. They don't respect module
> boundaries. They are not thread safe. They are essentially a relic
> of old programming techniques.
These are good points. I think that something like properties could
be useful, but I find that I use dedicated hash-tables anyway.
So, we should probably design some helper functions for doing the job
of properties, but in a more modern way. What about:
Function: make-object-property
Return a new `procedure with setter' P that can be used to attach
a property to objects. When calling P as
(set! (P obj) val)
where `obj' is any kind of object, it attaches `val' to `obj' in
such a way that it can be retrieved by calling P as
(P obj)
This makes it harder to see all properties of an object, but it is
unlikely that properties carry all interesting information about an
object anyway.
Behind the scenes, make-object-property could use a highly tuned
hashing scheme to maybe be even more efficient than the normal
properties that we now have.