Jackal

Decorators

01

@main Decorator

The entry point of the Jackal application. It tells the interpreter where to begin the execution flow.

spec_manifest.jk
@main
func main() {
    println("hello world")
}
02

@memoize Decorator

Used for performance optimization. It caches the results of function calls based on the input arguments to avoid redundant calculations.

spec_manifest.jk
@memoize
func counter(n) {
    let count = 1
    for (let i = 1; i < n; i++) {
        count = count * 2
    }
    return count
}
03

@parallel Decorator

Leverages multi-core processing by running the function on a separate thread using POSIX Threads integration.

spec_manifest.jk
@parallel
func counter(n) {
    let count = 1
    for (let i = 1; i < n; i++) {
        count = count + 1
    }
    return count
}
04

@async Decorator

Enables non-blocking background execution. The main thread continues running while the async task processes in the background.

spec_manifest.jk
@async
func count(n) {
    let count = 0
    for (let i = 0; i < n; i++) {
        count++
    }
    return count
}
05

@override Decorator

Ensures structural integrity by explicitly marking methods that implement or redefine members from an interface or parent class.

spec_manifest.jk
interface Greetable {
    func greet()
}

class Jack implements Greetable {
    @override
    func greet() {
        println("hello jackal")
    }
}

let jack = Jack()
jack.greet()
← Return to Index Technical Documentation