Live data from Hacker News

Ask HN: Great programming language features, other languages should steal?

news.ycombinator.com

11–20 of 44 posts

Re: Ask HN: Great programming language features, other languages should steal?

#12

I like how Erlang handles binary and bitstring data. Extremely useful if you're doing any sort of protocol implementation.

So many programs I've written would have been easier with Erlang's binaries and pattern matching. A lot of what I've done has boiled down to parsing and transforming binaries from one format to another. I've made a few POCs for work in the past (that I couldn't have convinced them to use no matter what, only C/C++/C#/Python were used) that demonstrated a much simpler version of core program logic because of those two features. The code was often 1/10th the size (if not smaller), clearer, and more extendable. And this wasn't just because I was writing it for a second (or third) time. The code in the other languages was good, clean code as well. It's just harder in those languages to express the same things as concisely.

Re: Ask HN: Great programming language features, other languages should steal?

#13
1. I like Erlang's Supervisor. If Go's goroutine has a unique ID, I think it can steal that design.

2. There was one new language that I don't remember the name, its data structures automatically turned to thread-safe upon concurrent access. That's smart. I wish all languages do that. Less data structure names people have to remember.

3. The compiler can cross-compiles to many different architectures similar to Go or Zig. This makes deployment story much simpler.

4. The compiler produces single binary by default. This also makes deployment story simpler.

5. This is year 2020. Every language must have an event loop so that they can have async I/O routines. Preferably in the form of CSP (green threads + channels).

As you can see I care about the ergonomics and tooling outside the language itself.

Re: Ask HN: Great programming language features, other languages should steal?

#14
post #6

1. Python's list slicing and indexing is the perfect mix of simplicity, intuition and power. It is surprising how few languages have similar implementations. 2. Currying like in Haskell.

Python list/set/dict comprehensions too

Re: Ask HN: Great programming language features, other languages should steal?

#15
This is pretty minor but I like how in Rust you can use constructs like if-statements and match-statements as expressions. For example:

  let foo = if some_condition {
      "condition is true"
  } else {
      "condition is false"
  };

  let bar = match x {
      0 => "string",
      1 => "another string",
      _ => "default"
  };
It's not super significant but I think it's an elegant syntactic feature.

Re: Ask HN: Great programming language features, other languages should steal?

#16
Golang, avoid this idea in the service of software engineering.

Go tries to be a syntax minimalist so that the writers can make what's there the best rather than building the world of fancy new PL features. It also means there are fewer days of doing the same thing and most people's code looks the same. <- this is such a difference maker

Re: Ask HN: Great programming language features, other languages should steal?

#18
post #6

1. Python's list slicing and indexing is the perfect mix of simplicity, intuition and power. It is surprising how few languages have similar implementations. 2. Currying like in Haskell.

Python list/set/dict comprehensions too

And generator comprehensions -- it's especially nice that you can directly write things like `sum(x*x for x in g)` without needing an extra set of parentheses or allocating an intermediate collection.

Re: Ask HN: Great programming language features, other languages should steal?

#20

This is pretty minor but I like how in Rust you can use constructs like if-statements and match-statements as expressions. For example: let foo = if some_condition { "condition is true" } else { "condition is false" }; let bar = match x { 0 => "string", 1 => "another string", _ => "default" }; It's not super significant but I think it's an elegant syntactic feature.

They got that from lisp.

But in lisp it's more than just a syntax trick that only works for a few predefined cases.

Post reply on HN