Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm working on an strace implementation in Rust, with an enum (tagged union) for system calls:

  enum Syscall {
     Open { pathname: Buffer, flags: u64, count: u64 },
     Read { fd: u64, buf: Buffer, count: u64 },
     ...
  }
I was very pleasantly surprised at being able to add a couple of dependencies, add #[derive(Serialize)] right above the struct, change two lines of my main driver program, and get an strace --json with useful output with no further effort. It's the sort of experience I expect from a higher-level language with dynamic types and runtime reflection, but available to me in a systems language.


Yes, and sometimes you really pay for runtime reflection - I've seen Java programs reduced to Python performance by excessive use of reflection. Whereas, this is _compile-time reflection_!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: