public static function isEmpty(callable $callback, Context $context): bool
    {
        $policy = $context->setAccessPolicy(Context::ACCESS_POLICY_RETURN_NULL);
        
        try {
            $val = $callback($context);
        } finally {
            $context->setAccessPolicy($policy);
        }
        
        if ($val instanceof \Countable) {
            return $val->count() == 0;
        }
        
        return empty($val);
    }