I like the changes you're considering quite a bit, but the syntax definitely feels clunky. Is there any reason you couldn't just do C-style variable types?
Also, is it necessary to keep "function"? Why not just use the return type:
PHP Code:
// double return value
double mean(double a, double b) {
return (a + b) / 2;
}
// no return value
void log(string message) {
echo(message);
}
// returns something, "def" is a type that can hold anything
def anything() {
def[] array = [player, this, "a"];
return array[int(random(0, array.size()))];
}
This syntax would be more comfortable for a lot of amateur and professional programmers.