Follow-up: I got a very instructive answer to this question at SO:
http://stackoverflow.com/a/29166218/1886357