compile-claw 0.2.6

The Claw language compiler library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { now } from wasi:clocks/monotonic-clock;
import { level, log } from wasi:logging/logging;

import foo as bar: func(a: string) -> string;

let max-nanos: u64 = 1000000;

export func foo(a: string) -> string {
    let start = now();
    let res = bar(a);
    let end = now();
    if end - start > max-nanos {
        log(level::warn, "profiling", "Calling foo took a long time");
    }
    return res;
}