2013/6/25 Nikita Popov <nikita....@gmail.com>:
> but I'm against the generic catch{} statement.

I'm sharing Nikita's opinion, with the difference of a bit more
enthusiasm on leaving off the variable as it could make it more
obvious that there is no intention in using the variable, and that no
memory should be kept for it. This might be better than doing:

try {
   [...]
} catch (Exception $ignore) {
    unset($ignore);
}

[...]

However, I see other cases where a variable is technically required
but not used:

abstract class AbstractPrinter {
    abstract public function print($message);
}

class Printer extends AbstractPrinter {
    public function print($message) {
        echo $message;
    }
}

class BlackholePrinter extends AbstractPrinter {
    public function print($message) {
    }
}

In the previous example, $message is not "used" in
BlackholePrinter::print() (as well as in AbstractPrinter::print()).
How do you intend to make that consistent with: catch(Exception) ?

Patrick

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to