Enforcing execution order of files

There are a few files that are generated by a script:

all.mc, foo.mc, bar.mc

all.mc:
const ALL = [null, null, null, FOO, null, BAR];

foo.mc:
const FOO = [...];
bar.mc:
const BAR = [...];
I get a compilation warning:
WARNING: fenix6: all.mc:4,6: Trying to access member '$.FOO', which may not be initialized.
WARNING: fenix6: all.mc:4,6: Trying to access member '$.BAR', which may not be initialized.
and indeed the app crashes, as all elements in ALL are null.
If I rename all.mc to zzz.mc then I still get the warnings, but it "works" (at least when I try it in the simulator)
Is there a way to make sure that all.mc knows to execute foo.mc and bar.mc beforehand?
  • If I rename all.mc to zzz.mc

    Having code execute alphabetically would be a disaster. It's not executing in alphabetical order.

    Either the order of execution doesn't matter OR the execution order is explicit in code.

    Fill your ALL array in a startup function.

  • Again: the above is a real example. It's a fact. It does execute alphabetically. It's not good, but that's how it is. But I don't want to depend on that, that's why I asked the question.

    These constants are generated by python. I can't fill them in startup code.

  • There's no guarantee that this will execute alphabetically. Optimization could change the order. (People can rename files.)

    Whose Python script?

    I have no idea why the Python script can't create a function to fill the array and not  be able to call that function in a startup function.

    The only place that all these objects are certain to be initialized is when the startup function is called.

    Either the order of execution doesn't matter OR the execution order is explicit in code.

  • OK, this works. This is generated in my all.mc:

    const ALL = [];
    function initializeAll() {
        ALL.addAll([null, null, null, FOO, null, BAR]);
    }

    and I call initializeAll() from the constructor of my app.