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. Number type conversions
8.4. Exceptions
8.5. Preconditions
8.6. Arrays
8.7. Ranges
8.8. Closures
8.9. File I/O
8.10. Array types
8.11. Misc.
9. Class augmentations
9.1. Wrapping a string with a function
9.2. Augmenting classes
9.3. Augmentation scopes, reusable augmentations
9.4. Named augmentations
9.5. Augmentations Resolution Order
9.6. 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. Banged function call
14.1. Principles and syntax
14.2. Banged decorators
15. Dynamic code evaluation
15.1. Loading a module
15.2. Anonymous modules
15.3. Functions
15.4. Running code
16. Concurrency with workers
16.1. The big picture
16.2. Worker environments
16.3. Spawning a worker and passing messages
16.4. A complete and useless example
17. Golo template engine
17.1. Example
17.2. Directives
18. Documenting Golo code
18.1. Documentation blocks
18.2. Rendering documentation
18.3. Alignment
19. Misc. modules
19.1. Standard augmentations (gololang.StandardAugmentations)
19.2. JSON support (gololang.JSON)
19.3. Scala-like dynamic variable (gololang.DynamicVariable)
19.4. Observable references (gololang.Observable)
19.5. Asynchronous programming helpers (gololang.Async)
20. Common pitfalls
20.1. new
20.2. Imports
20.3. Method invocations
20.4. match is not a closure