- Is Ballerina an interpreted language?
Ballerina is a compiled programming language. It compiles to a platform-neutral binary form which is then interpreted by the Ballerina runtime.
- How to build Ballerina programs? Do we need to set Ballerina Home or any other system variables?
There is no system variable concept when it comes to Ballerina. Download and install the OS-specific installer from https://ballerina.io/downloads/
Running Ballerina programs
Use ballerina run
command to compile and run Ballerina programs.
$ ballerina run hello.bal
Hello, World!
Use ballerina build
command to produce a statically-linked executable binary with the extension "balx". Then use ballerina run
command to run the program.
$ ballerina build hello.bal
$ ls
hello.bal hello.balx
$ ballerina run hello.balx
Hello, World!
- How Ballerina supports dependency management? Are there any recommended build tools?
A Ballerina program usually consists of multiple Ballerina packages. A package is a collection of source files. It defines a namespace and the symbols in all the source files in the package belong to that namespace. If you want to refer to a symbol defined in another package, you need to first import that package, then you can refer to the symbol with the package name.
When you want to execute or build a Ballerina program, Ballerina resolves all your import packages using your program directory, built-in repository (Ballerina distribution contains all the core library package as well as some third-party connector packages ), or the Ballerina repository directory. Ballerina repository is the local repository available in your machine.
We will develop tools for you to manage the Ballerina repository in the future.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…