Handle attributes changes

2014-08-17 Thread Matthieu via Digitalmars-d-learn
Hi! I'm trying to handle the fact that an attribute has change since I've set it for the first time (by desialising a bson), to abstract the only-modified fields update with vibe.d and mongodb, without storing two times the values. The idea is to have something like that : class Base { ...

Re: Handle attributes changes

2014-08-17 Thread Matthieu via Digitalmars-d-learn
I found this, which excactly is what I want to do : http://dlang.org/phobos/std_signals.html So in other terms, I want to abstract that, maybe with an UDA ? But can I do this without compile time code changes ? Thanks again!

Nullable instantiator anyone?

2014-08-17 Thread Nordlöw
I'm missing an instantiator function for std.typecons:Nullable. Is this is intentional? If not, is this Nullable!T nullable(T)(T a) { return typeof(return)(a); } sufficient for our needs?

Re: Nullable instantiator anyone?

2014-08-17 Thread bearophile via Digitalmars-d-learn
Nordlöw: I'm missing an instantiator function for std.typecons:Nullable. Is this is intentional? If not, is this Nullable!T nullable(T)(T a) { return typeof(return)(a); } sufficient for our needs? It could be sufficient, but note that in Phobos there are two different versions of

Using std.container.BinaryHeap like C++

2014-08-17 Thread Paulo Pinto via Digitalmars-d-learn
Hi, I was wondering if it is possible to use the BinaryHeap store like the C++'s make_heap/pop_heap/push_heap functions. I would like to port to D some A* C++ code I have which rearranges the priorities on the underlying store, followed by another make_heap() call on the vector used as store.

Re: Nullable instantiator anyone?

2014-08-17 Thread Nordlöw
On Sunday, 17 August 2014 at 18:51:38 UTC, bearophile wrote: It could be sufficient, but note that in Phobos there are two different versions of Nullable, one of them doesn't require extra memory, it uses one value as the null value. Ok, thanks for the reminder. Do you have a suggestion of

Re: Using std.container.BinaryHeap like C++

2014-08-17 Thread monarch_dodra via Digitalmars-d-learn
On Sunday, 17 August 2014 at 18:54:27 UTC, Paulo Pinto wrote: Hi, I was wondering if it is possible to use the BinaryHeap store like the C++'s make_heap/pop_heap/push_heap functions. I would like to port to D some A* C++ code I have which rearranges the priorities on the underlying store,

Re: Nullable instantiator anyone?

2014-08-17 Thread Ali Çehreli via Digitalmars-d-learn
On 08/17/2014 12:05 PM, Nordlöw wrote: On Sunday, 17 August 2014 at 18:51:38 UTC, bearophile wrote: It could be sufficient, but note that in Phobos there are two different versions of Nullable, one of them doesn't require extra memory, it uses one value as the null value. Ok, thanks for

Re: Nullable instantiator anyone?

2014-08-17 Thread Phil Lavoie via Digitalmars-d-learn
On Sunday, 17 August 2014 at 19:05:11 UTC, Nordlöw wrote: On Sunday, 17 August 2014 at 18:51:38 UTC, bearophile wrote: It could be sufficient, but note that in Phobos there are two different versions of Nullable, one of them doesn't require extra memory, it uses one value as the null value.

Static function at module level

2014-08-17 Thread Phil Lavoie via Digitalmars-d-learn
Ok, so after years of D usage I just noticed that this is valid D (compiles anyways): static void myFunc() {} What is a static function at module level exactly? In C, that means private, in D, that means ___? Thanks, Phil

Re: Static function at module level

2014-08-17 Thread Jonathan M Davis via Digitalmars-d-learn
On Mon, 18 Aug 2014 01:32:40 + Phil Lavoie via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Ok, so after years of D usage I just noticed that this is valid D (compiles anyways): static void myFunc() {} What is a static function at module level exactly? In C, that means

Re: Static function at module level

2014-08-17 Thread ketmar via Digitalmars-d-learn
On Mon, 18 Aug 2014 01:32:40 + Phil Lavoie via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: What is a static function at module level exactly? In C, that means private, in D, that means ___? nothing. static attribute for free function has no special meaning. but