refactor in headless.lang to pave the way for Tortoise
Merge branch 'headless' into tortoise
Tortoise: better error when a primitive is missing