36 lines
571 B
Plaintext
36 lines
571 B
Plaintext
:arf
|
|
author "Sasha Koshka"
|
|
license "GPLv3"
|
|
require "io"
|
|
---
|
|
|
|
# this is a global variable
|
|
data pv helloText:String:<"Hello, world!">
|
|
|
|
# this is a struct definition
|
|
type ro Greeter:Obj:(
|
|
.rw text:String:<"Hi.">)
|
|
|
|
# this is a function
|
|
func ro main
|
|
> arguments:{String ..}
|
|
< status:Int:<0>
|
|
---
|
|
let greeter:Greeter:mut
|
|
greeter.setText helloText
|
|
greeter.greet
|
|
|
|
# this is a member function
|
|
func ro greet
|
|
@ greeter:{Greeter}
|
|
---
|
|
io.println greeter.text
|
|
|
|
# this is mutator member function
|
|
func ro setText
|
|
@ greeter:{Greeter}
|
|
> text:String
|
|
---
|
|
greeter.text.set text
|
|
|