#main

public fn0(str) {
	echo str
	return PHP_CONST_DEMO
}

var a_function = fn0
var a_string = "string"
a_function('call with callable type')  	// okay
// a_string('call with string type')  		// error

internal fn1(callee Callable) {
	var unknow_type_value Any = callee('hei')
}

fn1(fn0)
fn1((str) => fn0(str))

// parameter reference
internal fn2(dict mut Int.Dict) {
	dict['num'] += 1
}

internal Data {
	ABC = 11
	static num = 3000
}

var dict = ['num': 1000]
fn2(dict)
echo "dict['num'] mutated by fn2: ${dict['num']}"

// callbacks
internal fn3(some Any, done (caller String) String, error (message) = none) String {
	return done('A cool man') concat ' with $some'
}

var out_num = 1
echo fn3(123, (a) => {
		out_num += 1
		return a#String concat ' has called'
	},
	(error) => {}
)

echo fn3('any...') -> done(caller String) {
	return "$caller has called!"
}
