The Golo Programming Language


Table of Contents

1. Basics
1.1. Editor / IDE support
1.2. Hello world
1.3. Running "Hello world"
1.4. Compiling Golo source code
1.5. Running compiled Golo code
1.6. Passing JVM-specific flags
1.7. Bash autocompletion
1.8. Zsh autocompletion
1.9. Comments
1.10. Variable and constant references
1.11. Data literals
1.12. Collection literals
1.12.1. A note on tuples
1.12.2. A note on maps
1.13. Operators
1.14. Calling a method
1.15. Java / JVM arrays
2. Creating new project(s)
2.1. Free-form project
2.2. Maven-driven project
2.3. Gradle-driven project
3. Functions
3.1. Parameter-less functions
3.2. Functions with parameters
3.3. Variable-arity functions
3.4. Functions from other modules and imports
3.5. Local functions
3.6. Module-level state
4. Java interoperability
4.1. Main function Java compliance
4.2. Calling static methods
4.3. Calling instance methods
4.4. null-safe instance method invocations
4.5. Creating objects
4.6. Static fields
4.7. Instance fields
4.8. Inner classes and enumerations
4.9. Clashes with Golo operators and escaping
4.10. Golo class loader
5. Control flow
5.1. Conditional branching
5.2. case branching
5.3. match statements
5.4. while loops
5.5. for loops
5.6. foreach loops
5.7. break and continue
5.8. Why no value from most control flow constructions?
6. Exceptions
6.1. Raising exceptions
6.2. Raising specialized exceptions
6.3. Exception handling
7. Closures
7.1. Defining and using a closure
7.2. Compact closures
7.3. Calling closures
7.4. Limitations
7.5. Closures to single-method interfaces
7.6. Direct closure passing works
7.7. Conversion to single-method interfaces
7.8. Getting a reference to a closure / Golo function
7.9. Binding and composing
7.10. Calling functions that return functions
8. Predefined functions
8.1. Console output
8.2. Console input
8.3. Exceptions
8.4. Preconditions
8.5. Arrays (deprecated)
8.6. Ranges
8.7. Closures
8.8. File I/O
8.9. Array types
8.10. Misc.
9. Class augmentations
9.1. Wrapping a string with a function
9.2. Augmenting classes
9.3. Augmentation scopes, reusable augmentations
9.4. Standard augmentations
10. Structs
10.1. Definition
10.2. JVM existence
10.3. toString() behavior
10.4. Immutable structs
10.5. Copying
10.6. equals() and hashCode() semantics
10.7. Helper methods
10.8. Private members
10.9. Augmenting structs
11. Dynamic objects
11.1. Creating dynamic objects
11.2. Defining values
11.3. Defining methods
11.4. Querying the properties
11.5. Defining a fallback behavior
12. Adapters
12.1. A simple example
12.2. Implementing interfaces
12.3. Overrides
12.4. Star implementations and overrides
12.5. Misc.
13. Decorators
13.1. Presentation
13.2. Principles and syntax
13.3. Use cases and examples
13.3.1. Logging
13.3.2. Pre/post conditions checking
13.3.3. Locking
13.3.4. Memoization
13.3.5. Generic context
14. Dynamic code evaluation
14.1. Loading a module
14.2. Anonymous modules
14.3. Functions
14.4. Running code
15. Concurrency with workers
15.1. The big picture
15.2. Worker environments
15.3. Spawning a worker and passing messages
15.4. A complete and useless example
16. Golo template engine
16.1. Example
16.2. Directives
17. Documenting Golo code
17.1. Documentation blocks
17.2. Rendering documentation
17.3. Alignment
18. Misc. modules
18.1. Standard augmentations (gololang.StandardAugmentations)
18.2. JSON support (gololang.JSON)
18.3. Scala-like dynamic variable (gololang.DynamicVariable)
18.4. Observable references (gololang.Observable)
18.5. Asynchronous programming helpers (gololang.Async)
19. Common pitfalls
19.1. new
19.2. Imports
19.3. Method invocations
19.4. match is not a closure