"body" keyword is unnecessary

Andrej Mitrovic andrej.mitrovich at gmail.com
Thu Mar 24 16:23:40 PDT 2011


On 3/24/11, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> Now, string is pretty bad on the whole, but then again, there are plenty of
> cases where you just don't care about what a string is for.

You don't care now, but you'll care later when its time to fix a bug.
Sometimes, its obvious what a name is by looking at the function call,
e.g.:
arr = getArrayOfInts();

But if this call is buried somewhere in the midst of spaghetti code
inside another function, and arr is used 100 lines below, by the time
you see it again you'll forget what it is for or what it contains.

Small functions that have these kinds of names are okay. Its the long
ones that are the problem. And the long ones usually have a multitude
of names like that. So you end up reading code written like this:

arr1 += arr3 * j / k;

Saves you a few seconds while writing, but makes you lose a lot of
time when trying to understand this code a few months down the road.


More information about the Digitalmars-d mailing list