Last active
August 30, 2022 08:17
-
-
Save joseoliv/a993fa5495e34ad6bb6b9a78f366511c to your computer and use it in GitHub Desktop.
Metaobject addMethodTo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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