how many lines of code can civilization support?

Is there any programming language theory that considers absolute upper bounds on how many lines of code (or bytes or whatever) a civilization can actively maintain (as a function of population size)?

Are such upper bounds low enough that the limit should inform programming language design?

re: TC and monads

(replying to a deeply nested question)

The `do` notation is syntactic sugar. For example, `do { a <- foo; b <- bar; baz a b }` desugars into `foo >>= \ a -> bar >>= \ b -> baz a b`. This desugared form is essentially a continuation-passing style - i.e. the 'bind' operator (>>=) receives both a representation for the foo action and a function/continuation to compute an action with the result.

Tail recursion applies normally to this desugared form. Monadic loop combinators are implemented using normal recursion. It is necessary that the bind op forget about old actions, but that's the normal case for monads, including IO. There might be some unusual backtracking or incremental monads where tail-recursion doesn't hold. In any case, the do notation isn't an issue.