Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
createPrototype
package metaobjectTest
@doc{*
Annotation 'createPrototype' creates one or two prototypes in the
current package given their names. It can be used
@createPrototype(prototypeName1, codeForPrototypeName1)
or
@createPrototype(prototypeName1, codeForPrototypeName1,
prototypeName2, codeForPrototypeName2)
prototypeName1 is created in phase dpa, and
prototypeName2 is created in phase afti.
*}
object CreatePrototype
@createPrototype(
"Dragon",
"package metaobjectTest\nobject Dragon\n func get -> Int { return 0 }\n\nend",
"Elf",
"package metaobjectTest\nobject Elf\n func get -> String { return \"Elf !\" }\n\nend"
)
func run {
let Dragon dragon = Dragon new;
assert dragon get == 0;
assert Elf() get == "Elf !";
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.