Mu:
Then how can I approach this to work for both cases: 1) output is empty? 2) output is the size of input? (MmFile's)
You have to tell those cases apart with a run time test, so your output range should support empty, or even length. If you want to overwrite the already allocated space, then I think you need the output range to be assignable, or to have items usable by ref. Other people should be able to give you a better answer.
Bye, bearophile