Example within documentations of D seriously need some improvement.

Jacob Carlborg doob at me.com
Fri May 27 12:49:17 PDT 2011


On 2011-05-27 19:24, Jonathan M Davis wrote:
> On 2011-05-27 06:31, Steven Schveighoffer wrote:
>> On Fri, 27 May 2011 09:22:01 -0400, Andrej Mitrovic
>>
>> <andrej.mitrovich at gmail.com>  wrote:
>>> On 5/27/11, Matthew Ong<ongbp at yahoo.com>  wrote:
>>>> http://www.digitalmars.com/d/2.0/operatoroverloading.html # people done
>>>> C++ can understand others may not.
>>>
>>> Well, explaining the concept of operator overloading should be a
>>> separate topic. People who know what operator overloading is will look
>>> in the language docs to figure out the syntax and use it right away.
>>>
>>> Doesn't Java have operator overloading? A lot of popular languages
>>> except maybe C have it, I think.
>>
>> Last I checked they do not. It's why the String class has charAt instead
>> of an equivalent opIndex.
>
> LOL. Yeah. Java will never have operator overloading. That would be on the
> list of features that were considered unsafe. And I know plenty of folks who
> are against operator overloading for similar reasons. Java has a lot of great
> stuff going for it, but it's overly stripped down in terms of features in the
> name of simplicity and safety, and operator overloading is definitely one of
> those that didn't make it in and never will. IIRC, they can't even get
> closures yet, even though it's the feature that's being pushed for the most
> and the Java folks were at least planning on implementing it. They'll never
> get operator overloading.
>
> - Jonathan M Davis

Actually Java has two operators overloaded that is + and += for strings, 
but that's nothing a user can take advantage of in his/her own 
implementations, it's basically part of the language. If one what's to 
use the JVM platform there's other alternatives available, like Scala or 
JRuby.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list