It is not possible to build circuits out of subroutines in some cases as all registers must be declared up front to create the quantum circuit object. This makes the addition of ancillary qubits inside sub-routines challenging from a modular algorithm development perspective.
Request a feature that enables “late” addition of qubits to circuits.
Can't you just call QuantumCircuit.add() https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/_quantumcircuit.py#L188-L197 to do this on an existing circuit object?
^ yes I think this works. We should document it more clearly. Maybe the method should be add_register().
i think we need to decide is a quantum register different to a classical so that this is clear
So I think we need two methods add_quantum_register and add_classical_register.
However the QuantumCircuit keeps track of all register, regardless of whether they are classical and quantum, in one array. This is another reason we need to use the DAG class as our Circuit class. There, the registers are kept separately.
Closing with #1284
Most helpful comment
^ yes I think this works. We should document it more clearly. Maybe the method should be
add_register().