Skip to content

Instantly share code, notes, and snippets.

@joseoliv

joseoliv/AddMethodTo.cyan

Last active Apr 23, 2021
Embed
What would you like to do?
Metaobject addMethodTo
package metaobjectTest
@addMethodTo("func zero -> Int", "func zero -> Int = 0;")
@addMethodTo(
"""func len: String s less: Int -> Int""",
"""
func len: String s less: Int n -> Int { return s size - n}
""")
object AddMethodTo
func run {
assert zero == 0;
assert self len: "abcde" less: 2 == 3;
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment