On 2014-11-08 17:44, Rahul Gopinath wrote:
I agree with leaving () out for the DSL usage.
Are there any such instances of DSL usage within conditionals
(if/unless/while...)? If not, would you be in favor if we restrict the
enforcement to conditionals only?
I think that would be rare (if at all in our code base at least).
- henrik
On Mon, Aug 11, 2014 at 7:00 AM, Henrik Lindberg
<henrik.lindb...@cloudsmith.com> wrote:
On 2014-11-08 2:01, Kylo Ginsberg wrote:
On Sat, Aug 9, 2014 at 9:45 AM, Henrik Lindberg
<henrik.lindb...@cloudsmith.com <mailto:henrik.lindb...@cloudsmith.com>>
wrote:
On 2014-09-08 24:13, Andy Parker wrote:
On Fri, Aug 8, 2014 at 3:11 PM, Rahul Gopinath
<ra...@puppetlabs.com <mailto:ra...@puppetlabs.com>
<mailto:ra...@puppetlabs.com <mailto:ra...@puppetlabs.com>>>
wrote:
While correcting AndOr, I come across methods calls such as
`if
value.is_a? FixNum or value.is_a? Integer`
How should we parenthesize it? is it `(value.is_a? FixNum) ||
(value.is_a? Integer)` or should it be `value.is_a?(FixNum)
||
value.is_a?(Integer)` ?
value.is_a?(FixNum)
Parens around the method arguments are the clearest fix and we
should
put them in everywhere IMO :)
+1, except in internal DSL like logic where it reduces readability
I definitely agree on the parentheses example above.
Wrt requiring parens around method arguments *everywhere*, I have to
admit I've wanted that at times when reading puppet code, but I also
suspect it would be very high touch and perhaps controversial.
And it sounds like we don't have consensus on that one. Henrik, can you
give an example or two where it would reduce readability? That might
help guide the discussion a bit.
The first that comes to mind is spec tests - it feels like you are using a
different language than ruby, but it is really a bunch of method calls
without parentheses.
i.e. do you want to write it like this?
context("this context") do
it("the thingy can ...") do
...
end
end
IMO, that adds no value at all.
In models:
class Program < PopsObject
contains_one_uni 'body', Expression
has_many 'definitions', Definition
has_attr 'source_text', String
has_attr 'source_ref', String
has_many_attr 'line_offsets', Integer
has_attr 'locator', Object
end
In the new function API:
dispatch :handle_enumerable do
param 'Any', :enumerable
param 'Hash', :options
end
Enforcing () in places like these sort of goes against the idea of using an
internal DSL.
- henrik
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/
--
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/lsaiai%24f9r%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/
--
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/lsaoop%24107%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.