A few notes on choosing between Go and D for a quick project
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Wed Mar 18 05:11:51 PDT 2015
Elazar Leibovich:
> I personally, would have no idea what this piece of code is
> doing upon first sight. I'll have to look at the documentation
> of
> at least two functions to understand that, and I'll have to
> think carefully about what and who would throw in case of an
> error.
>
> Something like
>
> while (n != EOF) {
> n = read(fd, buf, sizeof(buf));
> if (n==-1) throw(...);
> if (strcmp(buf, PREFIX) == 0) {
> return buf;
> }
> }
> return NULL;
>
> Requires no prior knowledge, and have similar effect.
>
> I'd rather have a loop written by hand in my production code
> any day, so that when debugging it, and reading it I'll have
> easier time
> to understand it, even though it would cost me a few more lines
> when writing the code.
Unfortunately your thinking is mostly obsolete, the programming
world (well, most of it, Go is one exception) is going in the
opposite direction, and for good reasons. An explanation:
https://channel9.msdn.com/Events/GoingNative/2013/Cpp-Seasoning
Bye,
bearophile
More information about the Digitalmars-d
mailing list