yank unary '+'?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Dec 7 09:35:59 PST 2009
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."
I disagree, and I think "not imagining a use for X" is a very weak
argument for removing X. When a feature is made to walk the plank, we
have much better arguments than that. Take typedef: it was ill-defined,
defining it properly would have been a major effort, and all benefits
could actually be emulated with a struct simpler and cheaper.
> Meanwhile, you're keeping C syntax for function-pointers around, and
> I'm missing syntactic sugar for my tribool.
C syntax for pointers to functions is there for a reason, but we're
considering removing it. For one thing, TDPL doesn't mention it.
> 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.
I was mostly talking about overloading operator +. Operator + has a long
history of being available for overloading in C++, which we can use to
our advantage. It has been used to emulate DSLs, but I think we have
much better means to define DSLs in D than to redefine all operators to
mean some convention-chosen things.
Andrei
More information about the Digitalmars-d
mailing list