Talking about the PLO in the lounge - page 16

 
Vasiliy Sokolov:

In normal programming languages(not C++),overloading the '=' operator is forbidden.

A normal language is your Sharp? And the only one you know? It sucks too, otherwise you wouldn't be saying things like "interfaces are not inheritance".

You know, the = operator is there, not as a sugar, but as an operator. And in MQL it is -- auto-generated, you know!

And the fact that in MQL the copy constructor is much more convenient than the one you've written, I don't even need to tell you about it. You were a dummy a few years ago and you still are. You've just boosted your ego with guys like Denisa.

 
Комбинатор:

...You just got your ego boosted by the likes of Denis.

You can't get me on specifics, so now you're turning on the rest of the forum. Mean and despicable.

(Note: he put the others in the third person and with a small letter, that is, without respect and "you're all nobodies here")

 
Vasiliy Sokolov:

In normal programming languages(not C++),overloading the '=' operator is forbidden.

It's very convenient for me, especially when I use template extensively, that it's possible to overload this operator. I overload it in many other situations as well.

And some operators overloading is almost completely forbidden in some languages, because it's completely deserved there as an anti-pattern. I suggest that before using any such overloading, especially assignment operator, one should think hard about why those silly architects of those silly languages do that.

A classic example of operator overloading is complex numbers and matrices. I don't see anything wrong with that. I write operators all the time because the code is no longer cumbersome and you can see the logic right away.


The simplest

struct MQLTICK : public MqlTick
{
  bool operator >( const double Price ) const
  {
    return(this.bid > Price);
  }

  bool operator <( const double Price ) const
  {
    return(this.ask < Price);
  }
};
 

Vasiliy Sokolov and Combinator, please stop swearing.

Otherwise we'll have to ban Volchanski as a provocateur :)

 
Vasiliy Sokolov:

You can't get me on specifics

don't you need more details? )) Write charp-code with assignment? Or show me how to write a copy-constructor? Or list languages with assignment operators? Talking about lack of specifics and making false accusations against me is much easier than admitting that you're full of shit
 
Rashid Umarov:

Or else we'll have to ban Wolchansky as a provocateur :)

Nah, who's gonna tell the stories? I'd rather be the instigator.

 
Vasiliy Sokolov:

I'm not going to be provoked by illiterate haters, and I'd better explain my point of view:

In normal programming languages(not C++)overloading of '=' operator is forbidden. And in some ones overloading of operators is forbidden almost completely, because it is completely deserved there as anti-pattern. I suggest that before using any such overloading, especially assignment operator, those who wish, think hard about why those silly architects of those silly languages do that.

And why are these "normal programming languages" ?

Overloading the assignment operator is very handy in many cases. The classic example is "smart pointers". The assignment operator must not only copy a pointer, but also make AddRef() - with overloading, all this is done transparently.

Why is it convenient? Because it makes much more sense to copy pointers rather than entire objects. (And with intensive copying in different places of the program it is difficult to see, if the object is needed or not. In this case smartpoints are very useful.

Of course, there are such things as "rubbish collector" - but I like this variant less, precisely because pointers have full access to the references and copy count, while rubbish collector does not. Not to mention that pointers destroy the object as soon as it's no longer needed, while the rubbish collector works with some delay.

 
George Merts:

Of course, there are things like "rubbish collector" - but I like that option less, precisely because the pointers have full access to the reference and copy count, while the rubbish collector does not. Not to mention that pointers destroy the object as soon as it's no longer needed, while the rubbish collector works with some delay.

Uh-huh, GC, even forcibly run, doesn't always delete everything. Sometimes this becomes a problem.
 
Vasiliy Sokolov:

I'm not going to be provoked by illiterate haters, and I'd better explain my point of view:

In normal programming languages(not C++)overloading of '=' operator is forbidden. And in some, operator overloading is forbidden almost completely, as it is quite deservedly considered anti-pattern there. I suggest that before using any such overloading, especially assignment operator, those who wish, think hard about why those stupid architects of those stupid languages do that.

Couldn't resist, personally to andrei: geez, don't embarrass yourself like that. You are saying such silly things: first about FP, now about operators. Want to hayterite - welcome: give references to authoritative sources, justify, etc.. What you are doing now is a rabid and most importantly totally illiterate hatred. You seem to be a programmer, like even a real one - it is shameful to write such things.


Vasily, it is desirable to specify the names of languages. The phrases "in normal," "in some", "these" do not add credibility to what is being said. We are programmers, not whitelists, so let's be specific in our statements.

 
Yuriy Asaulenko:
Uh-huh, GC, even when force-fed, doesn't always delete everything. Sometimes this becomes a problem.

If it thinks the object is likely to be created again soon, it won't remove it.