Live data from Hacker News

Wc in D: 712 Characters Without a Single Branch

dlang.org

1–10 of 89 posts

Re: Wc in D: 712 Characters Without a Single Branch

#3

I find D easier to grok coming from a Java/Python background.

I feel the same way too. It's fairly easy to translate Python into D, and you get all of that compile-time goodness to go with it (static type checking and compile-time function execution). And it's pretty fast! I bet we could optimise this D wc to match GNU's wc without too many crazy tricks.

Re: Wc in D: 712 Characters Without a Single Branch

#6

I find D easier to grok coming from a Java/Python background.

My only issue is that it's far more complicated than Java and for a language that fills that same niche it's hard for me to justify putting my resources into learning it even though I do like a lot of the features.

Re: Wc in D: 712 Characters Without a Single Branch

#8
A couple of points with comparing coreutils,

* recompiling with -march=native can give significant wins over more generic binaries provided by linux distros.

* parallel processing helps with bigger files, and it's easy enough to leverage the existing wc binary to process in parallel.

Both points are discussed at: https://www.pixelbeat.org/docs/unix-parallel-tools.html

Re: Wc in D: 712 Characters Without a Single Branch

#9
post #6

I find D easier to grok coming from a Java/Python background.

My only issue is that it's far more complicated than Java and for a language that fills that same niche it's hard for me to justify putting my resources into learning it even though I do like a lot of the features.

It's certainly possible to write more complicated code in a language like D than in Java. I personally find the verbosity of Java combined with jamming everything into a single approach makes Java hard to read.
Post reply on HN