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.
Wc in D: 712 Characters Without a Single Branch
11–20 of 89 posts
Re: Wc in D: 712 Characters Without a Single Branch
#12"without a single branch" I thought it meant actually a branchless version of wc. Turns out it's just no explicit if statements.
Re: Wc in D: 712 Characters Without a Single Branch
#13I'm wavering between D and Rust for which one could be used as a better alternative to C++. (Though I don't see C++ getting replaced anytime soon.) Even if Rust is getting most of the attention, D also seems to be a strong candidate.
Re: Wc in D: 712 Characters Without a Single Branch
#14The author claims to be IO bound toward the end. But they are comparing to two versions that are faster.
It is my understanding that IO-bound means that the IO subsystem is the thing which limits run time of the program. But the author clearly demonstrates that the IO subsystem of their machine is capable of supporting faster wc binaries.
So what am I missing here?
Re: Wc in D: 712 Characters Without a Single Branch
#15I find D easier to grok coming from a Java/Python background.
Re: Wc in D: 712 Characters Without a Single Branch
#16Re: Wc in D: 712 Characters Without a Single Branch
#17I find D easier to grok coming from a Java/Python background.
The syntax is familiar and the ideas are familiar. You don't have to learn anything new (not immediately anyway) like you do in Rust (where you basically need to learn EVERYTHING new).
Where this idyllic scenario starts falling apart with when you start actually using it for anything half-serious. Some of the bits feel extremely unintuitive and the documentation is difficult to navigate. There are few examples and the tutorial is a bit spartan. For example, I needed a deque-like container (double-ended queue), but it took me ages to figure out that a) the language actually has one and b) how to use the bloody thing.
There is also a bit of schizophrenia going on, with the "new" ideas and the "old" ideas clashing in some places. For example, they claim that you can run D without a GC (the new), but apparently a good chunk of the stdlib requires the GC (the old), so you're stuck.
I find this all to be unfortunate because D, to me, feels like it could be a better, saner C++.
Re: Wc in D: 712 Characters Without a Single Branch
#18Earlier quoted context omitted.
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.
In what way is more complicated than Java?
Re: Wc in D: 712 Characters Without a Single Branch
#19"without a single branch" I thought it meant actually a branchless version of wc. Turns out it's just no explicit if statements.
If you were careful, it seems pretty plausible to be able to use some indexing tricks and CMOV to write a jump/branchless version of wc. You are basically counting newlines and runs of whitespace.
Re: Wc in D: 712 Characters Without a Single Branch
#20Earlier quoted context omitted.
If you were careful, it seems pretty plausible to be able to use some indexing tricks and CMOV to write a jump/branchless version of wc. You are basically counting newlines and runs of whitespace.
CMOV aside, I remember it was proved MOV itself is turing-complete.
posting for anyone wondering