HNHacker News
TopNewBestAskShowJobs

hnakamur

9 karma · joined June 13, 2015

Please see http://hnakamur.github.io/ about me.
submissionscomments
hnakamur··on Zig, Skia, Clojure, Geometry and the Japanese TV Show: ICFP Contest 2021
I agree. For example, most of Rust libraries uses the drop handler (something like desctructors) to close a file descriptor. However it has problems since in async model closing is also async and it may return an error. So in tokio-uring explicit async close will be provided. https://github.com/tokio-rs/tokio-uring/pull/1/files#diff-3d...

And you can call close like: file.close().await.unwrap(); https://github.com/tokio-rs/tokio-uring/pull/17/files#diff-b...

hnakamur··on Durability: Linux File APIs
Thanks for your pointer. Do you mean this thread? "Json-Base – Database built as JSON files | Hacker News" https://news.ycombinator.com/item?id=23715558
hnakamur··on The Kivaloo Data Store
previous discussion: https://news.ycombinator.com/item?id=2378110
hnakamur··on Io_uring By Example: cat, cp and a web server with io_uring
How about https://github.com/quininer/io-uring ? It is licensed under either of Apache2/MIT.
hnakamur··on Hermes – A small JavaScript engine optimized for running React Native on Android
https://github.com/skiplang/skip

> The Skip project concluded in 2018 and Skip is no longer under active development at Facebook.

hnakamur··on Announcing Rust 1.13
In Go, I use https://github.com/pkg/errors these days and wrap errors with stack trace.

  package main
  
  import (
          "fmt"
          "io"
          "os"
  
          "github.com/pkg/errors"
  )
  
  func main() {
          v, err := run()
          if err != nil {
                  fmt.Printf("err=%+v\n", err)
                  os.Exit(1)
          }
          fmt.Printf("v=%d\n", v)
  }
  
  func run() (*int, error) {
          a, err := foo()
          if err != nil {
                  return nil, errors.WithStack(err)
          }
          b, err := a.bar()
          if err != nil {
                  return nil, errors.WithStack(err)
          }
          c, err := b.baz()
          if err != nil {
                  return nil, errors.WithStack(err)
          }
          return c, nil
  }
  
  func foo() (*a, error) {
          return new(a), nil
  }
  
  type a struct{}
  
  func (a *a) bar() (*b, error) {
          return new(b), nil
  }
  
  type b struct{}
  
  func (b *b) baz() (*int, error) {
          return nil, io.EOF // some arbitrary error for demo
  }
This prints a useful stack trace like below and you can know where the error occurred.

  $ go run main.go
  err=EOF
  main.run
          /home/hnakamur/go/src/bitbucket.org/hnakamur/stacktrace-demo/main.go:31
  main.main
          /home/hnakamur/go/src/bitbucket.org/hnakamur/stacktrace-demo/main.go:12
  runtime.main
          /usr/local/go/src/runtime/proc.go:183
  runtime.goexit
          /usr/local/go/src/runtime/asm_amd64.s:2086
  exit status 1
hnakamur··on Node9: Inferno kernel with LuaJIT instead of the Dis virtual machine
Great work! I created a build script for Node9: https://gist.github.com/hnakamur/13808187bf59e47456c3