github.com/neugram/ng@v0.0.0-20180309130942-d472ff93d872/eval/testdata/method3_error.ng (about)

     1  fn := func() interface{} {
     2  	four := 4
     3  	methodik obj struct{} {
     4  		func (a) Read([]byte) (int, error) {
     5  			return four, nil // ERROR: variable four is not defined in the global scope
     6  		}
     7  	}
     8  	return obj{}
     9  }
    10  
    11  // If this code worked, every time we call fn we would
    12  // generate a new type with a unique method implementation.
    13  // That would require run time creation of types with methods
    14  // to compile Neugram to Go, which does not yet exist.
    15  fn()