Hacker News new | ask | show | jobs
by grumblingdev 1030 days ago
JS also kills Python for inline functions thanks to hoisting.

It's much easier to follow the control flow with hoisting. I see `run()` being called, and then I want to know what it is. In other languages you are usually seeing a huge bunch of inline functions and then asking: okay, but when and how is this actually called?

    def foo():
      def run():
        print("hi")
      run()

    function foo() {
      run()
      function run() {
        console.log('hi')
      }
    }
1 comments

honestly I don't like this style of writing... in your js example I see `run()` and my first though is where the hell is run defined? is a global? I don't search - nor I write - the called function AFTER the calling ones, it seems backward to me.

moreover... basically any half-decent programmer text editor has an outline with the list of functions, so this point may be moot in any way