Hacker News new | ask | show | jobs
by koenigdavidmj 5451 days ago
> Go only allows named global functions, and lacks a feature that Pascal had.

    func main() {
    	bar := func() {
    		fmt.Println("Hello, 世界")
    	}
    	bar()
    }
What do I lose by doing that versus having 'func bar()'?
1 comments

this:

    func global(some_arg_to_close_over Bar) {
    	func walk_tree(node Node) {
            ...
            walk_tree(left(node))
            walk_tree(right(node))
    	}
    	walk_tree(something)
    }