Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » <<= and <<
Re: <<= and << [message #12958 is a reply to message #12957] Fri, 30 November 2007 13:52 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14255
Registered: November 2005
Ultimate Member
waxblood wrote on Fri, 30 November 2007 07:13

Quote:


<<= sets the WhenAction callback

<< adds a new callback to existing one; if there were any callbacks before assigned, they will be called as well.

In fact, "<<" is sort of experiment and is very rarely used



Reading code snippets in documentation '<<=' is always used instead of <<, but isn't the '<<' behaviour much more natural than the first one? Writing code with '<<' allows the programmer to modify callbacks stack of ancestor classes freely being at least a little more confident that those callbacks will always be executed before any one other callbacks in derived classes.
Using always '<<=' precludes this possibility.

I think it would be useful to develop plugin-oriented programs, too.



Interesting thoughts, yes, something like this is definitely possible path.

I guess using "<<=" is a result of two issues:

1. "<<=" existed long before "<<"
2. In real world applications, single action per callback is simply 99% of cases.

Quote:


I'm wondering, given the fact quite nobody uses the '<<' form, would it be possible to convert the '<<=' behaviour to '<<'?



Well, once again interesting idea... But here I am a bit afraid about changed semantics.

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Bug in Core06.cpp or in U++ Core value types tutorial
Next Topic: operator< for container sorting (small confusion)
Goto Forum:
  


Current Time: Mon Apr 28 23:14:42 CEST 2025

Total time taken to generate the page: 0.00891 seconds