My body is ugly [Re: Contextualizing keywords]

Don nospam at nospam.com
Mon Aug 3 00:11:28 PDT 2009


Robert Fraser wrote:
> Hi, hope you're all enjoying the properties debate.
> 
> I've been seeing the "too many keywords" argument a lot lately, and I 
> think it's definitely a valid argument. "shared" and "body" in 
> particular are rather annoying keywords since I frequently use them in 
> code. And if users are deciding not to use D because of the number of 
> keywords, that's even worse.

Why not just get rid of 'body'?

'body' is the most useless keyword in D. It's ugly, and doesn't achieve 
anything much at all -- it's just a compiler-checked comment, really.
Almost identical to // body

Compare:
----------------------
int foo(int a)
in {
    assert(a>2);
}
body
{
    return a-1;
}
----------------------
int foo(int a)
in {
    assert(a>2);
}
// body
{
    return a-1;
}
----------------------

That's a ridiculously tiny benefit for a keyword. I hate my body.
<g>



More information about the Digitalmars-d mailing list