"Robot registry" allowing access to built/known robots by index #462
Open
Description
[NOTE: see also the comprehensive discussion in #506 .]
I was frustrated today when I forgot to bind the result of build
to a variable name and it got me thinking about some related things again. What if every robot has a "registry" of robots that it has built, accessible by "child id"? In particular, I propose:
- adding a primitive
child : int -> robot
child n
evaluates to the nth child built by the robot evaluating it- when printing a robot value, print it in the form
child n
when possible (this will be most of the time) - maybe there could also be
friend : int -> robot
which is a registry of other robots you know about - evaluating some robot which is not a child will cause it to get added to the friend index, so it can be printed as
friend k
- note friend and child indices will be specific to each robot; they will have nothing to do with internal (globally unique) robot ids, which will be completely hidden
Originally posted by @byorgey in #343 (comment)
A suggested recipe for a robot index is counter
+ logger
.