Re: Static problem

2010-10-07 Thread Stanislav Blinov
Steven Schveighoffer wrote: What I'd propose is either: 1) Create your own lock-free associative array (yup, reinvent the wheel to introduce AA to the world of 'shared') 2) In this small case it may seem best (though mind that often such cases do grow up to the point when you still need to ret

Re: Static problem

2010-10-07 Thread Steven Schveighoffer
On Thu, 07 Oct 2010 16:18:26 -0400, Stanislav Blinov wrote: Bob Cowdery wrote: Could you please post the use case as well? It should matter not from what module you make the calls, as long as those calls are from the same thread. Different threads get different copies of the registry. I s

Re: Static problem

2010-10-07 Thread Stanislav Blinov
Bob Cowdery wrote: Could you please post the use case as well? It should matter not from what module you make the calls, as long as those calls are from the same thread. Different threads get different copies of the registry. I suspected that might be the case. Yes they are from separate threa

Re: Static problem

2010-10-07 Thread Bob Cowdery
On 07/10/2010 20:33, Stanislav Blinov wrote: > Bob Cowdery wrote: >> Can someone sort out what I'm doing wrong here please. >> - >> import std.concurrency, std.stdio; >> import Definitions.procNames; >> >> class CRegistry { >> static Tid[E_PROC] TidRegistry; >> >> static void

Re: Static problem

2010-10-07 Thread Stanislav Blinov
Bob Cowdery wrote: Can someone sort out what I'm doing wrong here please. - import std.concurrency, std.stdio; import Definitions.procNames; class CRegistry { static Tid[E_PROC] TidRegistry; static void register(E_PROC name, Tid tid) { writeln(TidRegistry);

Static problem

2010-10-07 Thread Bob Cowdery
Can someone sort out what I'm doing wrong here please. - import std.concurrency, std.stdio; import Definitions.procNames; class CRegistry { static Tid[E_PROC] TidRegistry; static void register(E_PROC name, Tid tid) { writeln(TidRegistry); TidRegistry[name] =

Re: Object di (Newbie)

2010-10-07 Thread Steven Schveighoffer
On Thu, 07 Oct 2010 07:50:49 -0400, Vasileios Anagnostopoulos wrote: What is the purpose of object.di? where can I learn more? http://www.digitalmars.com/d/2.0/dmd-linux.html#interface_files I believe the purpose for object.di is to hide the runtime implementation from the importer.

Re: std.container: SList linearRemove confusion

2010-10-07 Thread Johannes Pfau
On 07.10.2010 19:09, Steven Schveighoffer wrote: > On Thu, 07 Oct 2010 12:44:48 -0400, Johannes Pfau wrote: >> Is this really the expected behavior for linearRemove? > > Yes, an SList range is terminated by a null pointer, so there is no > limit to how far it will iterate. > > Try to construct a

Object di (Newbie)

2010-10-07 Thread Vasileios Anagnostopoulos
What is the purpose of object.di? where can I learn more?

Re: std.container: SList linearRemove confusion

2010-10-07 Thread Steven Schveighoffer
On Thu, 07 Oct 2010 12:44:48 -0400, Johannes Pfau wrote: Hi, I'm currently trying to replace the array in my signal implementation with the SList from std.container. I need to remove elements from the list, but I can't seem to get it right. According to the documentation, I expect linearRemove

std.container: SList linearRemove confusion

2010-10-07 Thread Johannes Pfau
Hi, I'm currently trying to replace the array in my signal implementation with the SList from std.container. I need to remove elements from the list, but I can't seem to get it right. According to the documentation, I expect linearRemove to remove the contents of the passed range, but linearRemove

Re: Stop function parameters from being copied.

2010-10-07 Thread Lars T. Kyllingstad
On Thu, 07 Oct 2010 14:43:25 +, Benjamin Thaut wrote: > If I want to tell the compiler that a certain function argument should > not be copied (say a large struct, or a array) which is the right way to > do? > > arrays: > 1. function foo(in float[] bar) { ... } 2. function foo(ref > const(flo

Re: Stop function parameters from being copied.

2010-10-07 Thread Simen kjaeraas
Benjamin Thaut wrote: If I want to tell the compiler that a certain function argument should not be copied (say a large struct, or a array) which is the right way to do? arrays: 1. function foo(in float[] bar) { ... } 2. function foo(ref const(float[]) bar) { ... } 3. something else For ar

Re: Stop function parameters from being copied.

2010-10-07 Thread Steven Schveighoffer
On Thu, 07 Oct 2010 10:43:25 -0400, Benjamin Thaut wrote: If I want to tell the compiler that a certain function argument should not be copied (say a large struct, or a array) which is the right way to do? arrays: 1. function foo(in float[] bar) { ... } 2. function foo(ref const(float[]) b

Stop function parameters from being copied.

2010-10-07 Thread Benjamin Thaut
If I want to tell the compiler that a certain function argument should not be copied (say a large struct, or a array) which is the right way to do? arrays: 1. function foo(in float[] bar) { ... } 2. function foo(ref const(float[]) bar) { ... } 3. something else structs: 1. function foo(in largest

Re: class x is hidden by y

2010-10-07 Thread Simen kjaeraas
bearophile wrote: In D classes start with an upper case, and methods with a lower case (and both generally use camelCase/CamelCase instead of underscores). So the way to write that code is: abstract class Foo { protected: void wrongType() { Yes, if one is to slavishly follow the rule

Re: class x is hidden by y

2010-10-07 Thread bearophile
Benjamin Thaut: > abstract class foo { > protected: > void WrongType(){ > assert(0,"Using wrong type"); > } In D classes start with an upper case, and methods with a lower case (and both generally use camelCase/CamelCase instead of underscores). So the way to write tha

[solved]Re: class x is hidden by y

2010-10-07 Thread Benjamin Thaut
Thanks, that fixes it Kind Regards Benjamin Thaut

Re: class x is hidden by y

2010-10-07 Thread Denis Koroskin
On Thu, 07 Oct 2010 10:43:12 +0400, Benjamin Thaut wrote: For the following code in D 2.0 using dmd 2.049: import std.stdio; abstract class foo { protected: void WrongType(){ assert(0,"Using wrong type"); } public: void Update(int value){WrongType();}

Re: write to file ... trivial?

2010-10-07 Thread Denis Koroskin
On Thu, 07 Oct 2010 01:36:23 +0400, Dr. Smith wrote: Thank you. Indeed, I forgot: auto f = File("outfile.txt", "w"); Interestingly, this apparently works within a for-loop to overwrite the file on the first iteration and appending otherwise (Should there not be an explicit append arg?):