Suppose that you are the star of a 1980s-era murder mystery show. You have just spent the last forty-five minutes, minus commercials, unraveling the murderous plot of a certain language architect. In the ensuing climactic scene, with a grand flourish, you emphatically point your finger at a certain bearded fellow and yell, “So, ladies and gentleman, the person who killed the productivity of modern programmers is in fact BJARNE STROUSTRUP
A hush befalls the crowd. All eyes are on Stroustrup. He knows he is guilty. He knows you know he is guilty. What is he going to do? Will he try to deflect blame toward Andrew Koenig
? Will he attempt to flee to Mexico, where the authorities do not come down very hard on coding abuses?
For our purposes, it doesn’t matter, because that is not the important part of the story. As the keen readers among you have already detected, the important thing here isn’t Stroustrup’s murderous trail of language modifications, but the pointing.
And pointing, as it turns out, was also critical to the next piece of code I wrote for The Witness’s Lister Panel.
In The Witness, there are entities called “groups” which are just collections of other entities. Normally, groups can be nested inside other groups, and can exist for all sorts of purposes. But in special circumstances, a group is designated as a “layer”.
In the implementation, this is almost meaningless. It is simply a boolean that is set on the group which says “hey, by the way, I am a layer”. But in the UI, these layers are important because they are things which are supposed to show up in a special, easy-to-access view in the lister panel where they can be quickly hidden, shown, and selected.
Last week, I showed how to get the lister to a point where it was listing entities with a type filter, but that doesn’t help when the criteria for filtering is based on data inside the actual entities, as opposed to their type. So I needed to add something different.
As always, the first thing I did was to take a look at the sorts of things I actually wanted to do when filtering. I wrote the code I’d need to use to filter an entity “e” by whether or not it was a layer: