November 13, 2003
In article <bou4i2$hnl$1@digitaldaemon.com>, Achilleas Margaritis wrote:
> 
> "davepermen" <davepermen_member@pathlink.com> wrote in message news:bos3at$9qt$1@digitaldaemon.com...
>> >I'm pretty sure that a search of the archives will reveal that the only person who is happy with having binary operators as member functions is the one who's writing the compiler. The rest of us are quite unhappy about it
>>
>> the easiest would be to not write a compiler at all..
>>
>> so, Walter, please think about operators as functions, not methods. this is rather important, you know?! if you know c++ then you know its uses, and you know as well that it gains oo logic, namely... you make the object more "closed".. i don't remember the correct namings..
>>
>> i want 3 things. one (ONE) stream-operator, operator overloads as functions, and implicit instanciated templates.
>>
>> then, i'm done. :D
>>
> 
> Yes!!! this is very important. Operators are just syntactic sugar. They should just be declared outside of classes!!!

Indeed, I think operators and functions should have equal rights. 1 + 2 is just a little bit more readable way to say add(1, 2).

If operators aren't allowed outside objects, then why does D allow freestanding functions, then? Maybe all functions should be member functions, like in Java.

-A

November 13, 2003
> Maybe all functions should be member
> functions, like in Java.

That would save us all the trouble of learning D, and Walter the trouble of writing it. ;)


November 14, 2003
Achilleas Margaritis wrote:

> Yes!!! this is very important. Operators are just syntactic sugar. They
> should just be declared outside of classes!!!

This would work well with structs, but not with classes, because they would not inherit correctly.

One could think of static member functions being searched in both classes participating in an operation, but this would violate the D overloading rule which only works within the same scope.

-eye

November 14, 2003
where are the problems?

if you want to have inheritation, make an operator-method, and overload the operator then.. inherits great.

In article <bp2l79$1je7$1@digitaldaemon.com>, Ilya Minkov says...
>
>Achilleas Margaritis wrote:
>
>> Yes!!! this is very important. Operators are just syntactic sugar. They should just be declared outside of classes!!!
>
>This would work well with structs, but not with classes, because they would not inherit correctly.
>
>One could think of static member functions being searched in both classes participating in an operation, but this would violate the D overloading rule which only works within the same scope.
>
>-eye
>


1 2
Next ›   Last »