Question: I'm using HHVM to write a system tool and I cannot for the life of me figure out why this code issues an error when I run `hh_client`

```
$__al_paths = array();

function requires(string $classPath): void {
    global $__al_paths;
    $className = basename($classPath);
    if (!isset($__al_paths[$className])) {
       $__al_paths[$className] = AL_CLASSES_FOLDER.'/'.$classPath.'.'.AL_CLASS_EXTENSION;
    }
}

```

This issues the following when I run `hh_client`

```
/usr/lib/mango/tools/autoloader.hh:9:9,19: Expected

```

The line it is pointing to is the line that says

```
global $__al_paths;

```

Which is being declared in the `global` scope. This appears to be a syntax error, it is as if the `global` keyword is not supported on HHVM, however I checked the documentation and it has several examples of it being using in Hack code.

Answer: 
Instead of using `global` try to rewrite your code like this (called dependency injection):

```
function requires(string $classPath, $__al_paths): void {
    $className = basename($classPath);
    if (!isset($__al_paths[$className])) {
       $__al_paths[$className] = AL_CLASSES_FOLDER.'/'.$classPath.'.'.AL_CLASS_EXTENSION;
    }
}

```

Then call it like:

```
$__al_paths = array();

requires('classpath', $__al_paths);

```

This way you produce much more flexible and more stable code than playing around with globals which should been deleted from every humans mind.
UPDATE !!!

This seemed to solve the problem, I'd like to know why the `global` keyword doesn't work though.

```
$__al_paths = array();

function requires(string $classPath): void {
    $__al_paths = $GLOBALS['__al_paths'];
    $className = basename($classPath);
    if (!isset($__al_paths[$className])) {
        $__al_paths[$className] = AL_CLASSES_FOLDER.'/'.$classPath.'.'.AL_CLASS_EXTENSION;
        $GLOBALS['__al_paths'] = $__al_paths;
    }
}

```