Closed cratuki closed 7 years ago
I was weighing up whether this was too trivial to justify effort. But having done it, it is clear that it is a marked improvement.
Whilst I was in there, I added in some validation to check that the user is passing in a class, rather than an instance of it. This would be a trap-for-young-players style of error. I am impementing this via inspect. Inspect is fine here, because it is not an event-loop overhead.
Previously we often had two verbose lines to create a track.
self.track_blah = self.orb.reference_track(
construct=TrackClass)
The construct parameter was useful to reenforce to the user that we should pass in a class.
Now, we can do this with confidence,
self.track_blah = self.orb.track(TrackClass)
It has taken a while for the Track concept to become a first-class concept in solent. It now feels like it is.
There is a kind of object called a Track. It is used to listen to the nearcast, but never to interact with it. It is useful in particular for consolidating business-logic code in a single place, whilst letting multiple cogs access it. it is also useful for only accumulating knowledge in RAM once, rather than once for each cog.
Currently we attach it to a cog like this,
It is laborious to write 'reference_track'. Let's just change it to 'track'.