const query<screen> local_screens = local_cinemas .jump(screens, screens->cinema_id == local_cinemas->id);
This statement builds on the query
in much the same way that the previous statement built on the table
The effect of
can be understood as follows: imagine we took the output of
local_cinemas, and replaced each
all the records in
That would give us the output of the query we just built. All those records
are of type
the new query is a
Notice that this operation would work just as well if
were replaced by some other query with the same output as
local_cinemas, or even by a simple table
that contained all the records that
produces. And that is generally the way: when I build upon one query to
make another, I try not to depend on any details of how the first query
was built. That makes the code easy to refactor later.
We learnt in the previous section that
value mapper is identical to
value mapper. So I could have written
It would have worked the same, and it would have saved six keystrokes,
but I went the other way. Why? To avoid dependence on the detail of how
local_cinemas was made.
If some future round of refactoring eliminates the
table, and builds
in some different way, the code here will still compile and run.
I'm expressing a stylistic preference, no more, and it may not be very important -- except insofar is it helps to explain code examples in this document that would be puzzling if you didn't know.