Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Closure world...

  • Name resolution rules...
  • local variable name
  • (all variables declared in closures are considered local vars)
  • outer class static names
  • outer class dynamic names
  • Code can move into and out of closures WITHOUT any changes - irrespective of the method implemetnation detail
  • the compiler, IDE, shell can KNOW that the names map to (assuming the outer class is static, not open/dymamic

...

  • The builder decides what vanilla names mean

normal static resolution

  • local variables
  • delegate to builder.. it decides...
  • default order is,
  • static builder names
  • static outer class names
  • dynamic builder names
  • dynamic outer class names
  • Builders
    Code Block
    // builder land
    
    idea...
    
    swing.{
        frame() {
            panel {
                button()
            }
        }
        title = "foo"
    }
    
    builder (swing).frame {
        panel {
            button(title:"foo")
        }
        title = "hey"
    }
    
    use (swing) {
      frame {
        panel {
            button(title:"foo")
        }
        title = "hey"
      }
    }
    
    //jez idea...
    swing("""
     frame{panel{button()}} 
    """)
    
    def c = with() {
      frame {
        panel {
            button(title:"foo")
        }
        title = "hey"
      }
      
    swing << c
    }
    

possible precedence rules from within usage of a builder

Johns proposal...

  • local variables
  • static outer class names
  • dynamic outer class names
  • static builder names
  • dynamic builder names

James proposal...

normal static resolution

  • local variables
  • static outer class names

changed dynamic resolution...

  • static builder names
  • dynamic builder names
  • dynamic outer class names

Markup ideas

Stuff Guillaume is happy-enough with

...