Hacker News new | comments | show | ask | jobs | submit login

To play devils advocate here... This specific example could be solved with implicit returns in Coffeescript:

    class FileInfo

      constructor: (@name)->

      mtime: ->
        #implicit return
        @withFile (f)->
          if f.time isnt 999 then "too old"

      withFile: (block)->
        try
          block
            name: @name
            time: 1000
        finally
          console.log 'finished'

    f = new FileInfo('name')
    console.log f.mtime()
#finished

#too old




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: