[Nh-pm] quoting list keys & values

Paul Lussier pll at lanminds.com
Fri Aug 2 10:59:50 CDT 2002


In a message dated: Fri, 02 Aug 2002 10:16:14 EDT
Erik Price said:

> But my confusion arose from the fact that even when 
>using strict, hash keys are exempt from the requirement of being quoted 
>strings.
[...snip...]
>This is what I was wondering about.  You're not forced to quote these 
>particular string literals even with -w and strict.  But ... is it good 
>form to do so?

Is it good form?  Yes.  Is it required? No.

My personal philosophy is that code should written such that it's 
obvious what the code is doing to someone else who didn't write it.

I'm also a very strong proponent of consistency.

So, though I'd ideally prefer:

	%hash = ( 'foo' => 1,
		  'bar' => 2,
		);

I'd rather see:

	%hash = ( foo => 1,
		  bar => 2,
		);


than:

	%hash = ( 'foo' => 1,
		  bar => 2,
		);

Better consistently wrong, than occasionally right, at least wrt 
coding practises; since they ycan often be corrected with a simple
sed 's/x/y/h', or, perl -e 's/x/y/;'  in this case :)




-- 

Seeya,
Paul
--
	It may look like I'm just sitting here doing nothing,
   but I'm really actively waiting for all my problems to go away.

	 If you're not having fun, you're not doing it right!





More information about the Nh-pm mailing list