Comment

Comment by shrimp_emoji

Look at this C++ code:

  std::vector<Pair<std::string, MyInt>> s;
  s.push_back(Pair<std::string, MyInt>("a", MyInt(1)));
  s.push_back(Pair<std::string, MyInt>("b", MyInt(2)));
  s.push_back(Pair<std::string, MyInt>("c", MyInt(3)));
Gross. I'm being punished.

Look at this Rust code:

  let mut s = Vec::new();
  s.push(Pair::new("a", 1));
  s.push(Pair::new("b", 2));
  s.push(Pair::new("c", 3));
Both are statically typed, but one uses inference. It practically feels like Python everywhere except where type declarations matter most to me -- function signatures:

  fn foo(x: f64, y: f64) -> Point {...}
In Python, those aren't very helpful.

  def foo(x, y): ...
:c

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton