> 2) Can a function be written which searches the slots of all the objects
> of a certain class to find a certain value, and which returns that
> object as a value:
> find-me(<man>, height == 75")
Dylan does not automatically maintain a collection of all the instances of
a given class. You can do that yourself, using an initialize method and
whatever subclass of <collection> you like, and then scan that collection
in your find-me function. For example, you could make a <table> keyed by
some attribute of your object, and find-me could look in that table. Or
you could make a <list> of all your objects, and find-me could check them
one by one.
To say the same thing in other words, Dylan is a programming language, not
Note that all the builtin collection types, and any you could define
yourself in a portable way, will prevent an object in the collection from
being reclaimed even if it is otherwise unreferenced. Whether this is a
problem depends on your application. If you know when you are done with
an object, you can remove it from the collection of all objects
> If anybody knows how I can direct the flow of my program from instance
> number x of <example-object> to instance number z of <example-object>,
> please, please tell me.
If your instances are numbered, you can create a <vector> keyed by the
numbers, whose elements are your instances.
But, stepping back a bit, your questions suggest to me that you're not
thinking about objects in the way that Dylan expects you to. Dylan is not
a relational database. If you're using "ids" instead of directly
referring to objects, this may be a sign of "incorrect" thought. When I
say "incorrect", I don't mean there is anything wrong with you, it's just
that your way of thinking doesn't match Dylan's way of thinking. If one
object has a second object that is related to it, put a slot in the first
object whose value is the second object. Don't go indirectly through
tables keyed by IDs, unless you have to.
You might find it worth your while to read a Dylan Programming textbook.
At this level, even a Java or C++ or CLOS or Objective C or Smalltalk
textbook would help, since all of those languages think of objects in a
way similar to how Dylan thinks of them.