On Jul 30, 2014, at 1:02 PM, John Bollinger <[email protected]> wrote: [...] > Here are the tests for the future parser (as changed by the PR) > > ["thing" ,"resource", ["thing"]], > ["[thing]" ,"resource", ["thing"]], > ["[[nested, array]]" ,"resource", ["nested", "array"]], > > > I still find that last one surprising, but if it really matches the current > behavior then so be it. What's the rule here, though? Array titles are > automatically flattened?
Just a small note here: I implemented this behavior intentionally, because it seemed the least of the available evils. When I first added the ability for resources to have arrays as titles, I didn't have any available operations for arrays. So, my choice was: Fail if you used nested arrays; change resources to support arrays as titles or behave appropriately if they got one and couldn't handle it; add complex array operations (so you could do things like flatten arrays); or just flatten for you. In most cases, it's not been a problem, but as we're looking at building a more coherent and consistent language, it makes sense to revisit this behavior. Note that when I implemented this, Puppet had almost no functions available by default, and no such thing as calling methods on objects, so implementing "flatten($array)" or "$array.flatten" would have been a pretty big leap. I think either would be less of a leap today, and it probably makes more sense to ask the user to transform their data into a valid form than to try to do magic transformations. And, as discovered, we clearly need to become a lot more careful in what kind of data we accept in these fields overall. So, to summarize: Yes, this is intentional, and it made sense at the time. It probably doesn't make sense as the default behavior much longer, though. [...] -- http://puppetlabs.com/ | http://about.me/lak | @puppetmasterd -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/088A2359-251C-4F27-95E6-A60C659C214F%40puppetlabs.com. For more options, visit https://groups.google.com/d/optout.
