== Quote from bearophile ([email protected])'s article > Jonathan M Davis: > > I would have thought that being more idomatic would have resulted in slower > > code > > than what Walter did, but interestingly enough, both programs are faster > > with my > > code. They might take more memory though. I'm not quite sure how to check > > that. > > In any cases, you wanted some idiomatic D2 solutions, so there you go. > Your code looks better. > My (probably controversial) opinion on this is that the idiomatic D solution > for those text "scripts" is to use a scripting language, as Python :-) > In this case a Python version is more readable, shorter and probably faster > too because reading the lines of a _normal_ text file is faster in Python compared to D (because Python is more optimized for such purposes. I can show benchmarks on request). > On the other hand D2 is in its debugging phase, so it's good to use it even > for purposes it's not the best language for, to catch bugs or performance bugs. So I think it's positive to write such scripts in D2, even if in a real-world setting I want to use Python to write them. > Bye, > bearophile
I disagree completely. D is clearly designed from the "simple things should be simple and complicated things should be possible" point of view. If it doesn't work well for these kinds of short scripts then we've failed at making simple things simple and we're just like every other crappy "large scale, industrial strength" language like Java and C++ that's great for megaprojects but makes simple things complicated. That said, I think D does a great job in this regard. I actually use Python as my language of second choice for things D isn't good at. Mostly this means needing Python's huge standard library, needing 64-bit support, or needing to share my code with people who don't know D. Needing to write a very short script tends not to be a reason for me to switch over. It's not that rare for me to start with a short script and then end up adding something that needs performance to it (like monte carlo simulation of a null probability distribution) and I don't find D substantially harder to use for these cases.
