Re: std.pattern.. templated publisher subscriber pattern, adding events to collections

2010-07-06 Thread Rory McGuire
On Wed, 07 Jul 2010 00:47:32 +0200, BLS wrote: Okay a bit better snippet than before. snippet should be almost functional.. /* Hi, Andrei brings in the idea of std.pattern. Seems that this module is "stalled"; Unfortunately ! However I would like to enhance collection classes (likewise dco

Re: Mixing operations with signed and unsigned types

2010-07-06 Thread Ellery Newcomer
On 07/06/2010 07:05 PM, Stewart Gordon wrote: Ellery Newcomer wrote: On 07/05/2010 07:59 AM, Stewart Gordon wrote: bearophile wrote: Stewart Gordon: I can also imagine promoting your mindset leading to edit wars between developers declaring an int and then putting assert (qwert >= 0); in the

Re: Mixing operations with signed and unsigned types

2010-07-06 Thread Stewart Gordon
Ellery Newcomer wrote: On 07/05/2010 07:59 AM, Stewart Gordon wrote: bearophile wrote: Stewart Gordon: I can also imagine promoting your mindset leading to edit wars between developers declaring an int and then putting assert (qwert >= 0); in the class invariant, and those who see this and thi

Re: std.pattern.. templated publisher subscriber pattern, adding events to collections

2010-07-06 Thread BLS
Hi Dimitry, thanks for the feedback! Please have a look at the new snippet (just posted) msg is a ref parameter cause it is filled in our example from Stack. The Publisher mixin HOST. In other words. Where ever you mixin the Publisher template a message will be broad casted to all subscriber

Re: std.pattern.. templated publisher subscriber pattern, adding events to collections

2010-07-06 Thread BLS
Okay a bit better snippet than before. snippet should be almost functional.. /* Hi, Andrei brings in the idea of std.pattern. Seems that this module is "stalled"; Unfortunately ! However I would like to enhance collection classes (likewise dcollections) with a Publisher - Subscriber pattern (

Re: std.pattern.. templated publisher subscriber pattern, adding events to collections

2010-07-06 Thread Dmitry Olshansky
On 07.07.2010 2:01, BLS wrote: Hi, Andrei brings in the idea of std.pattern. Seems that this module is "stalled"; Unfortunately ! However I would like to enhance collection classes (likewise dcollections) with a Publisher - Subscriber pattern (signal - slot, or observer pattern) , if you prefer)

std.pattern.. templated publisher subscriber pattern, adding events to collections

2010-07-06 Thread BLS
Hi, Andrei brings in the idea of std.pattern. Seems that this module is "stalled"; Unfortunately ! However I would like to enhance collection classes (likewise dcollections) with a Publisher - Subscriber pattern (signal - slot, or observer pattern) , if you prefer) Hope the idea of enhancing

Re: const and immutable

2010-07-06 Thread Steven Schveighoffer
On Tue, 06 Jul 2010 16:08:21 -0400, Tim Verweij wrote: == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article I'm not positive, but I think the second const applies to the second function, I think you meant: const Bar& GetBar() const { return mBar; } Uh, yes, of course. Pff, I fe

Re: const and immutable

2010-07-06 Thread Tim Verweij
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > I'm not positive, but I think the second const applies to the second > function, I think you meant: > const Bar& GetBar() const { return mBar; } Uh, yes, of course. Pff, I feel bad for making such an embarrasing mistake. > And ye

Re: const and immutable

2010-07-06 Thread Steven Schveighoffer
On Tue, 06 Jul 2010 12:10:04 -0400, Tim Verweij wrote: Not sure if I'm double posting now. Sorry if I am, but I didn't see my own post appear this time. Anyway, thanks for your replies, that was very helpful. I had one more question about inout. If I understand correctly it cannot be use

Re: const and immutable

2010-07-06 Thread Tim Verweij
Not sure if I'm double posting now. Sorry if I am, but I didn't see my own post appear this time. Anyway, thanks for your replies, that was very helpful. I had one more question about inout. If I understand correctly it cannot be used to get rid of the double GetBar function in the following C++

Re: const and immutable

2010-07-06 Thread Tim Verweij
Thanks for all replies, that was very helpful. I have one more question about inout. If I understand correctly, it is always coupled to the use of a parameter and cannot be used to get rid of the double GetBar in the following C++ example: class Foo { public: const Bar& GetBar() { return bar; }

Re: const and immutable

2010-07-06 Thread Steven Schveighoffer
On Tue, 06 Jul 2010 10:56:11 -0400, Tim Verweij wrote: Hey all, I'm having some trouble understanding the whole const and immutable of D2, especially since it seems documentation is not consistent (Or I'm missing some things). I write quite a lot of C++ code btw, so I'm familiar with th

Re: const and immutable

2010-07-06 Thread BCS
Hello Tim, I think I understand the difference between const and immuable when considering references and pointers, but how exactly is const different from immutable in: [...] const(int) somefunc(); versus immutable(int) somefunc(); BTW both of those are pointless. The following works: imp

Re: const and immutable

2010-07-06 Thread Simen kjaeraas
Tim Verweij wrote: http://www.digitalmars.com/d/2.0/const3.html includes D examples like: void foo(const int* x, int* y) Is the information on the first page not updated for D2? That seems correct. Is the following correct? (this confuses me) immutable int somefunc(); means the same

const and immutable

2010-07-06 Thread Tim Verweij
Hey all, I'm having some trouble understanding the whole const and immutable of D2, especially since it seems documentation is not consistent (Or I'm missing some things). I write quite a lot of C++ code btw, so I'm familiar with that. --- http://www.digitalmars.com/d/2.0/htomodule.html says: D