public function setHash($value) {
        // TODO: freeze the instance after configuration and automatically call copy()

        if (isset($value)) {
            if (!is_scalar($value)) throw new IllegalTypeException('Illegal type of parameter $value: '.gettype($value));
            if (is_bool($value))
                $value = (int) $value;
        }
        $value = (string) $value;
        $path = $this->getPath();
        $this->setPath(strLeftTo($path, '#', $count=1, $includeLimiter=false, $onNotFound=$path).'#'.$value);

        return $this;
    }