On Friday, July 11, 2014 7:50:47 PM UTC-7, henrik lindberg wrote: > > > Here we have another problem; variables defined in classes are very > different from those defined elsewhere - they are really > attributes/parameters of the class. All other variables follow the > imperative flow. That has always bothered me and causes leakage from > classes (all the temporary variables, those used for internal purposes > etc). This is also the source of "immutable variables", they really do > not have to be immutable (except in this case). > > If we make variables be part of the lazy logic you would be able to write: > > $a = $b + 2 > $b = 2 > > I think this will confuse people greatly. >
Slightly off-topic so I'll keep it short. I have a huge appreciation for immutable variables in the Puppet language as I think it helps keep people centered in the mindset of declarative configuration and not procedural programming. The fact that variable values are parse-order dependent is detrimental in that it forces users to hold and visualize a more complex model in order to not get tripped up by parse-order dependencies. Resources can only be declared once and can be referred to before they've been hit by the parser. I would strongly support variables being the same. Today they are immutable and so have one foot in that door. Making them part of the lazy logic sounds like it could get them the rest of the way. Outside of technical implementation challenges, it would be a good thing if variables were immutable and lazily evaluated in such a way as to make the example given above work. Is there an existing thread or Jira ticket that would be a more appropriate place to discuss further? -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/e492657e-4deb-4f85-afa5-fc404bc9518e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.