On Aug 5, 2014, at 6:41 PM, Reid Vandewiele <r...@puppetlabs.com> wrote:

> Visual review, for convenience:
> 
> file { $title: * => $attributes; }
> file { $title: => $attributes; }
> file { $title: ($attributes); }
> file { $title: attribute_defaults => $attributes; }
> file { $title: attribute_hash => $attributes; }


Sorry for joining the party late; I'm clearly not quite on the same email 
cadence. :/

I think there are some other interesting middle grounds.  In particular, we 
could add explicit merge operations, like other languages have for hashes:

# Make some functions for merging a hash into a resource
file { $title: mode => 644 }.merge($attributes) #destructively merge
file { $title: mode => 644 }.default($attributes) #prefer specified attributes

# Alternative: Make operators for merging
file { $title: mode => 644 } & $attributes # Or something like that

In other words, get rid of the whole concept of explicitly specifying defaults, 
and also get rid of anything inside the curlies, and just modify the resource 
in place with a function or operator.

In my head, the bitwise operators seemed like an obvious operator set to use; 
in practice, it looks, um, questionable at best.  At the least, any of the 
above statements would be expected to affect the resource, and it's tough to 
say that's obvious from the syntax.

I do like the explicitness of it, 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 puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/69F21637-06EA-428A-AA02-982777591D4F%40puppetlabs.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to