News for hackers. Stuff that matters.
Re:Ask HN: What are some cool but obscure data structures yo... by samatman on Friday July 22, 2022 @05:30AM (#32190186)
promise map?

do you mean

    setmetatable({}, {__index = function(tab, key)
          local co = coroutine.running()
          uv.read(fd, function(err, result)
               tab[key] = result
               return coroutine.resume(result)
            end)
          return coroutine.yield()
      end })
This is an incomplete implementation, clearly: but I've never missed Promises with coroutines and libuv.

There are no comments on this comment yet.