3 karma · joined Sep 2, 2024 (2y ago) · 6 submissions
comment 1y ago · link · parent
func doesNotUnderstand(method, args) {
"Person " + this.name + " does not have " + method
}
}func greet(person: Person) { match person { {name: "Alice", age: 30} => "Hi Alice, you're 30." {name, age} if age > 18 => "Hi " + name + ", you're an adult." _ => "Hello there!" } }
macro log_call(func) { `(println("Calling " + ${func})) }
let alice = new Person("Alice", 30) log_call(greet(alice)) # Expands to println and calls greet
comment 1y ago · link · parent