#!/usr/bin/env mio

TGreetable = Trait clone() do (
    hello = method(
        print("Hello", self name)
    )
)

World = Object clone() do (
    name = "World!"
    use(TGreetable)
)

adapt = block(obj, trait,
    return (obj clone() use(trait))
)

Foo = Object clone() do (
    name = "Foo!"
)

world = World clone()
world hello()

foo = adapt(Foo, TGreetable)
foo hello()
