[chef] Re: Re: Re: Re: Re: Re: FC001, attributes as strings vs symbols


Chronological Thread 
  • From: Josiah Kiehl < >
  • To:
  • Subject: [chef] Re: Re: Re: Re: Re: Re: FC001, attributes as strings vs symbols
  • Date: Wed, 17 Oct 2012 11:00:41 -0700

I'm not sure this decision is important enough to warrant calling it a best practice. Is there really harm in having one cookbook use symbols and another use strings? I've never encountered a gotcha that is caused by mixed accessing.

I can see why you'd want to be consistent within a cookbook, but ultimately it's not going to make a difference.

I just turn off this check and let people do what they will. I personally use symbols as it's more comfortable given I was a ruby developer before I learned Chef.

Josiah

On Wed, Oct 17, 2012 at 10:50 AM, Phil Dibowitz < " target="_blank"> > wrote:
On Wed, Oct 17, 2012 at 01:01:17PM -0400, Jay Feldblum wrote:
> Phil,
>
> That's correct. Under the hood, it's all strings.
>
> The symbol and method syntaxes are just a small bit of sugar over the
> underlying string syntax. But all of the node attribute keys are kept as
> strings internally. And all of the methods that fetch keys or iterate over
> the elements give the keys as strings, not as symbols (and certainly not as
> methods).

Right. And I think that's a pretty good reason for the best practice to be
"always use strings unless you have a reason to do otherwise."

--
Phil Dibowitz                             ">
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Be who you are and say what you feel, because those who mind don't matter
 and those who matter don't mind."
 - Dr. Seuss





Archive powered by MHonArc 2.6.16.

§