Closed gavr123456789 closed 2 weeks ago
type Person
name: String
extend Person [
on sleep = "sleeeping" echo
on sayHello = "Hi! I'm $name" echo
]
// interface for Person
type Human
yapping: []
sleeping: []
Program h::Human = [
h sleeping do
h yapping do
]
p = Person name: "Alice"
pr = Program new
sayHelloReference = &p sayHello
sleepingReference = &p sleep
// human =
pr h: (Human yapping: sayHelloReference sleeping: sleepingReference)
Creating separate references is not nesessery (niva is clojure after all)
Type with all members codeblock can be used as interface! Thanks @pyrotek45 for insparation nova:
niva: