jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • groovy
  • GROOVY-1528

Binding behave oddly with closures

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: 3.0
  • Component/s: None
  • Labels:
    None
  • Environment:
    Ubuntu 6.06 LTS "Dapper Drake" + JDK 1.5.0_06 + Groovy r 4109

Description

The script:

a = 1
a.b = 2

correctly fails with a "no such field b for class Integer". However the script:

c = { }
c.b = 3
println ( c.b )
println ( b )

prints:

3
3

which has to be wrong on 2 fronts: a closure doesn't have a property b; setting c.b should not create an entry b in the binding.

John agreed this should almost certainly be treated as a bug.

Issue Links

depends upon

Task - A task that needs to be done. GROOVY-2503 MOP 2.0 design inflluencing issues

  • Major - Major loss of function.
  • Open - The issue is open and ready for the assignee to start work on it.

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
blackdrag blackdrag added a comment - 03/Jul/07 12:26 PM

the closure does not know the difference between property requests from inside the closure block or from outside. As a result it tries to set the property b in the binding, which of course works. But I still consider this as bug, a closure should not allow that

Show
blackdrag blackdrag added a comment - 03/Jul/07 12:26 PM the closure does not know the difference between property requests from inside the closure block or from outside. As a result it tries to set the property b in the binding, which of course works. But I still consider this as bug, a closure should not allow that

People

  • Assignee:
    blackdrag blackdrag
    Reporter:
    Russel Winder
Vote (0)
Watch (1)

Dates

  • Created:
    12/Oct/06 3:08 PM
    Updated:
    13/Oct/08 7:42 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.