Haven't used Gosu before. Exploring Java
.jars, some syntax, dependencies, compilation, etc. Used a bit in the Insurance industry.
docker compose up# Exec in
## Three ways to interact with .gsp
## Gosu - change the package...
### Evaluates the full directory path as the classpath!
gosu src/main/gosu/thoughtscript/io/example/App.gsp
## Inline
gosu -e 'print(\"Hello world!\")'
## Maven
### Fresh compile before-hand...
mvn compile
mvn exec:java -Dexec.mainClass="thoughtscript.io.example.App"- Maven dependencies:
gosu-parent- contains synchronized dependencies, compiler settings, etc.gosu-coreandgosu-core-api- the actual language and interface.- (
gosu-parentapparently contains bothgosu-coreandgosu-core-api.)
- Although
stringandStringare interchangeable (apparently, with the former being an alias for the latter akin to C#objectandSystem.Object). the JIT Interpreter will cry foul:"string" is not a valid type. [line:6 col:30] in line 5: //string is like C# System.Object alias for String... line 6: static function main(args: string[]) { line 7: print("Hello from the Main method!") Line Number: 6 Column: 30
- The
gosuJIT interpreter to execute.gspscripts:It seems that going this route requires that packagegosu src/main/gosu/thoughtscript/io/example/App.gsp
thoughtscript.io.examplebe changed to:main.gosu.thoughtscript.io.examplesince it evaluate the full directory path as the classpath. - Maven:
mvn clean install compile mvn exec:java -Dexec.mainClass="thoughtscript.io.example.App" - Gotcha's:
- Cannot name
Main.gspand haveMainClass within it otherwise it throws a redundant Class Error./app/src/main/gosu/thoughtscript/io/example/class/Example.gsp:[3,7] error: Duplicate class found at: thoughtscript.io.example.class.Example.Example.
- There is no Main Method in Gosu.
- Importing using
packageanduses.usesis primarily for importing Java libraries.- FYI - this exploratory example doesn't presently demontrate relative imports or
uses.
- FYI - this exploratory example doesn't presently demontrate relative imports or
- Gosu dot notation for accessing fields.
propertyforsetandget. gosu --versionmust be run in the Terminal - for some reason adding it to the Dockerfile results in an error.- Double
WORKDIRin dockerfile due to recommended installation/setup.
- Cannot name