Peter Corlett abuse at cabal.org.uk
Fri Feb 13 11:01:37 GMT 2009

On 12 Feb 2009, at 23:59, David Alban wrote:
> aesthetic preference.  i like that:
>  $var = $EMPTY_STRING;
> is very readable.  more so for me than:
>  $var = '';

Although as a maintenance programmer, you then have yet another level  
of indirection, and need to confirm that $EMPTY_STRING really was set  
to "" and stays that way, and it's not somebody being cute or malicious.

Here's a fine argument for my position that I found in the Movable  
Type codebase:

use constant FALSE => -99999;
use Exporter;
*import = \&Exporter::import;
use vars qw( @EXPORT );
@EXPORT = qw( FALSE );

Like comments, constant names should expand on the meaning of the code  
rather than just repeat it, and should mean the same thing in each  
place. So TRUE and FALSE are fair game, as they indicate something is  
boolean. ONE, not so much, as it doesn't tell me anything more than a  
literal 1 would have done, and 1s will often different things in  
different places.

More information about the london.pm mailing list