Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,37 @@
^|EMal doesn't support abstract types with partial implementations,
|but can use interfaces.
|^
type Beast
interface
fun getKind = text by block do end
fun getName = text by block do end
fun getCry = text by block do end
end
type Dog implements Beast
model
text kind
text name
fun getKind = text by block do return me.kind end
fun getName = text by block do return me.name end
fun getCry = text by block do return "Woof" end
end
type Cat implements Beast
model
text kind
text name
fun getKind = text by block do return me.kind end
fun getName = text by block do return me.name end
fun getCry = text by block do return "Meow" end
end
type AbstractType
^|Beast b = Beast() # interface instantiation is not allowed|^
fun bprint = void by Beast b
writeLine(b.getName() + ", who's a " + b.getKind() + ", cries: " + b.getCry() + ".")
end
^|instantiation works because a positional variadic constructor
|has been auto generated
|^
var d = Dog("labrador", "Max")
Cat c = Cat("siamese", "Sammy")
bprint(d)
bprint(c)