The style guide says to use single quotes, except when variables are present in the string, and then double quotes should be used. That bothers me. It means your using two different types of quotes, when just one could be used. I mistakingly used single quotes around a string with a ${variable} in it, and it seemed to work fine. Any reason we can''t just stick to single quotes? Doug. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
----- Original Message -----> The style guide says to use single quotes, except when variables are > present in the string, and then double quotes should be used. > > > That bothers me. It means your using two different types of quotes, > when just one could be used. I mistakingly used single quotes around > a string with a ${variable} in it, and it seemed to work fine. Any > reason we can''t just stick to single quotes?you''re confused. notice(''${fqdn}'') notice: Scope(Class[main]): ${fqdn} variables are not expanded in single quotes. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hmmm.... Ok then..... I''ll change my question to, why doesn''t the style guide say to stick with double quotes for all strings and keep it consistent? On Sun, Jun 5, 2011 at 9:30 AM, R.I.Pienaar <rip@devco.net> wrote:> > > ----- Original Message ----- > > The style guide says to use single quotes, except when variables are > > present in the string, and then double quotes should be used. > > > > > > That bothers me. It means your using two different types of quotes, > > when just one could be used. I mistakingly used single quotes around > > a string with a ${variable} in it, and it seemed to work fine. Any > > reason we can''t just stick to single quotes? > > you''re confused. > > notice(''${fqdn}'') > > notice: Scope(Class[main]): ${fqdn} > > variables are not expanded in single quotes. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- Regards, Douglas Garstang http://www.linkedin.com/in/garstang Email: doug.garstang@gmail.com Cell: +1-805-340-5627 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
----- Original Message -----> Hmmm.... Ok then..... I''ll change my question to, why doesn''t the > style guide say to stick with double quotes for all strings and keep > it consistent? >i dont like it either but its probably to make you think about your strings and when you specifically want variable expansion. also consider the common case of making yum repos: yumrepo{"foo": baseurl => ''http://mirror.netcologne.de/centos/$releasever/os/$basearch/''} always using ''s means you wont accidentally expand $releasever and $basearch. There are many cases where string expansion is not desirable like above. I prefer double quote wherever possible personally.> > On Sun, Jun 5, 2011 at 9:30 AM, R.I.Pienaar < rip@devco.net > wrote: > > > > > > > > ----- Original Message ----- > > The style guide says to use single quotes, except when variables > > are > > present in the string, and then double quotes should be used. > > > > > > That bothers me. It means your using two different types of quotes, > > when just one could be used. I mistakingly used single quotes > > around > > a string with a ${variable} in it, and it seemed to work fine. Any > > reason we can''t just stick to single quotes? > > you''re confused. > > notice(''${fqdn}'') > > notice: Scope(Class[main]): ${fqdn} > > variables are not expanded in single quotes. > > -- > You received this message because you are subscribed to the Google > Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com . > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en . > > > > > -- > Regards, > > Douglas Garstang > http://www.linkedin.com/in/garstang > Email: doug.garstang@gmail.com > Cell: +1-805-340-5627 > > > > -- > You received this message because you are subscribed to the Google > Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- R.I.Pienaar -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Sun, Jun 05, 2011 at 09:36:59AM -0700, Douglas Garstang wrote:> Hmmm.... Ok then..... I''ll change my question to, why doesn''t the style > guide say to stick with double quotes for all strings and keep it > consistent?Most languages honour the convention that variables are not expanded within single quotes. I always use single quotes unless expansion is a requirement or the string itself contains single quotes; it signals to the interpreter/compiler that it need not inspect the string contents for expansion and saves a few cpu cycles. It signals the same to the alert human reader who may be debugging the code. I consider that more valuable than consistency for consistency''s sake. -- Bruce I must admit that the existence of Disneyland (which I know is real) proves that we are not living in Judea in AD 50. -- Philip K. Dick -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Bruce is correct. If you don''t need double quotes, don''t use them. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/TVNhOGVjTE9wSEFK. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.