On Feb 17, 2011, at 3:22 PM, Paul Berry wrote:

> On Thu, Feb 17, 2011 at 3:17 PM, Luke Kanies <[email protected]> wrote:
> luke@syringe $ ruby -e 'a = "foo"; b = -a'
> -e:1: undefined method `-@' for "foo":String (NoMethodError)
> luke@syringe $
> 
> 
> Yes, but this error doesn't come from Ruby's parser.  It is a runtime error 
> at the time that Ruby detects that you are trying to apply unary minus to a 
> string.  Ruby allows unary negation of variables that hold numeric values:
> 
> [ticket/2.6.next/6338] ~/puppet_labs/puppet$ ruby -e 'a = 3; b = -a; puts b'
> -3
> [ticket/2.6.next/6338] ~/puppet_labs/puppet$ 

Ah, you're right.  I tried a few iterations and they all failed; I didn't think 
to stick to numbers rather than strings, duh.

-- 
No matter how rich you become, how famous or powerful, when you die
the size of your funeral will still pretty much depend on the
weather.        -- Michael Pritchard
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199



-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to