public function setVariable(string $name, $value, bool $as_instance = true)
    {
        $this->variables[$name] = $value;
        if (is_object($value))
            $this->instances[get_class($value)] = $value;
        return $this;
    }