More specifically: Is it possible to configure a barrel from within another barrel?
From a procedural point of view, this seems to be possible: If I have two barrels, OuterBarrel and InnerBarrel, VS Code lets me create a reference from OuterBarrel to the InnerBarrel project, that is, to the InnerBarrel's monkey.jungle file. And then the OuterBarrel's barrels.jungle file contains these lines:
InnerBarrel = [<some-path>\InnerBarrel\monkey.jungle] base.barrelPath = $(base.barrelPath);$(InnerBarrel)
However, whenever I try to use code in InnerBarrel from OuterBarrel, I get a plethora of vague error messages. For example, InnerBarrel.mc looks like this:
import Toybox.Lang;
import Toybox.System;
module InnerBarrel {
class InnerClass {
public function returnSomething() as String {
return "something";
}
}
public function printInner() {
Toybox.System.println("Inner barrel");
}
}
And OuterBarrel.mc has this code:
import InnerBarrel;
import Toybox.System;
module OuterBarrel {
var innerVar as InnerClass;
var anotherInnerVar as InnerBarrel.InnerClass;
public function printOuter() {
System.println("Outer barrel");
printInner();
InnerBarrel.printInner();
var local = innerVar.returnSomething();
}
}
In the above code, a lot of statements give an error message about not being able to find InnerBarrel:
- var innerVar as InnerClass; (where, interestingly, the statement var anotherInnerVar as InnerBarrel.InnerClass; does not give an error message)
- printInner();
- InnerBarrel.printInner();
- var local = innerVar.returnSomething();
All of this seems to suggest that it is not possible to configure a barrel from within another barrel (even though the Configure Barrel command lets you do it). Or am I missing something trivial here?