Vita Rara: A Life Uncommon

I think there's a bug...

I'm on Groovy 1.0 because I have a project that doesn't run under 1.5 for reasons yet unresolved. I think there is a bug in Binding because I think the following code should fail to run, but it doesn't:

try {
  def binding = new Binding ()
  
  def someVariable = "some value"
  
  binding.setVariable ("someVariable", someVariable)
  c = { true }
  c.setBinding (binding)
}

println someVariable

someVariable should not be defined outside the scope of the try block, but it is. Remove the binding stuff from the try block and it does fail saying someVariable is not defined.

Mark

Reply

Please solve the math problem above and type in the result. e.g. for 1+1, type 2
  • Allowed HTML tags: <a> <img> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <h1> <h2> <h3>
  • Lines and paragraphs break automatically.
More information about formatting options