yank unary '+'?

Bill Baxter wbaxter at gmail.com
Mon Dec 7 08:34:52 PST 2009


On Mon, Dec 7, 2009 at 4:00 AM, Don <nospam at nospam.com> wrote:
> Michiel Helvensteijn wrote:
>>
>> Andrei Alexandrescu Wrote:
>>
>>>> What will removing it gain you?
>>>
>>> Sancta simplicitas.
>>
>> Hm.. I don't really buy that argument.
>>
>> I see you and Walter removing/witholding things (incomparability
>> operators, logical operator overloading) from the language, because: "I
>> can't imagine a use for it and removing it makes the language simpler."
>>
>> Meanwhile, you're keeping C syntax for function-pointers around,
>
> C declaration syntax is on the chopping block. Walter hasn't actually
> removed any features yet from DMD releases.
>
> and I'm missing syntactic sugar for my tribool.
>
>>
>> The fact that you or I think there isn't a use for a feature, doesn't mean
>> there isn't one. Programmers keep finding new and unintended uses for
>> language features, which is a good thing. And if you want to simplify the
>> language, I wouldn't start with the unary + when you've still got all that C
>> stuff around.
>
> Yes, but D is getting *really* big. The language complexity is a problem. We
> need to cut out everything we can possibly can. Unary + is a nice example of
> something that is almost completely useless.

I say you should completely chop it then.  Leaving it in for literals
only leaves a mess that's hard to justify.
I have often written things like

  glVertex2f(-boxRadius,-boxRadius);
  glVertex2f(+boxRadius,-boxRadius);
  glVertex2f(+boxRadius,+boxRadius);
  glVertex2f(-boxRadius,+boxRadius);

And often code like that starts out as something with constants:

  glVertex2f(-1,-1);
  glVertex2f(+1,-1);
  glVertex2f(+1,+1);
  glVertex2f(-1,+1);

I would find it quite confusing and annoying if the latter worked but
the former did not.
But I could live with it if neither worked.

--bb



More information about the Digitalmars-d mailing list