Re: shared std.signals

2013-01-22 Thread Joshua Niehus
On Wednesday, 23 January 2013 at 07:11:59 UTC, Joshua Niehus wrote: Is it possible to create a shared signal class? oh god... dont tell me __gshared ! Think i answered my own question, it got me to the next step. going to have to read through those giant "shared" threads again

shared std.signals

2013-01-22 Thread Joshua Niehus
Is it possible to create a shared signal class? I would like to create a shared signal class so some other process that knows certain things can come along emit its info to any observer: import std.stdio, std.signals; class Observer { void watch(string msg) { writeln(msg); }

Re: MS ODBC encoding issue

2013-01-22 Thread Sam Hu
I've tested and the Chinese character issue really fixed! But I have two more issues here. 1.for connect with DSNless string function provided by my original code as below,I can not make it to connect successfully with really database file.Don't now why yours works. bool connect(string connec

Re: MS ODBC encoding issue

2013-01-22 Thread Sam Hu
On Thursday, 17 January 2013 at 18:36:16 UTC, Regan Heath wrote: On Mon, 14 Jan 2013 10:02:04 -, Regan Heath wrote: Ok, solved the issue I think. Appreciatd all the help and am very excited that it finaly works,WOW! Now I can see (in Visual-D debugger) the Chinese characters in the ro

Re: Win32 api with 2.061

2013-01-22 Thread Andrej Mitrovic
On 1/22/13, cal wrote: > I am trying to compile a project using the Win32 api header's > (the Dsource ones) with 2.061 and am getting errors for the first > time with things like this: Try making these changes: https://github.com/AndrejMitrovic/WindowsAPI/commit/6d8ef98508063c5a4741c72eda68aa485d

Re: Error by building druntime

2013-01-22 Thread Namespace
On Tuesday, 22 January 2013 at 22:15:13 UTC, Namespace wrote: In my distress I have now tried with dmd_msc_vs10. I get no such error but others: 1>cl : Befehlszeile warning D9025: "/TC" wird durch "/TP" überschrieben 1>mars.c(905): warning C4805: '!=': unsichere Kombination von Typ 'char' mit

Re: Win32 api with 2.061

2013-01-22 Thread David
Am 22.01.2013 23:25, schrieb cal: > const uint WINVER = blah try: static const uint WINVER = blah But I have no idea why it changed

Win32 api with 2.061

2013-01-22 Thread cal
I am trying to compile a project using the Win32 api header's (the Dsource ones) with 2.061 and am getting errors for the first time with things like this: const uint WINVER = blah Error: variable WINVER cannot be read at compile time. I just want to confirm if this is due to a change in the

Re: Error by building druntime

2013-01-22 Thread Namespace
In my distress I have now tried with dmd_msc_vs10. I get no such error but others: 1>cl : Befehlszeile warning D9025: "/TC" wird durch "/TP" überschrieben 1>mars.c(905): warning C4805: '!=': unsichere Kombination von Typ 'char' mit Typ 'bool' in einer Operation 1>c1xx : fatal error C1083: Datei

Re: Error by building druntime

2013-01-22 Thread Namespace
dmc prints before Digital Mars Compiler Version 8.42n and also after I replaced it with your version. Have I forget something? And still the same error. That weird. oO

Re: Error by building druntime

2013-01-22 Thread Namespace
On Tuesday, 22 January 2013 at 21:35:48 UTC, Namespace wrote: dmc prints before Digital Mars Compiler Version 8.42n and also after I replaced it with your version. Have I forget something? And still the same error. That weird. oO Ah, I forgot, sorry. I'm using: Digital Mars Make Version 5.06

Re: Error by building druntime

2013-01-22 Thread monarch_dodra
No idea. Just updated my own dmd sources. I rebuilt it fine with both dmc 852c and 856c, in both release non-release :/

Re: Error by building druntime

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 20:47:46 UTC, Namespace wrote: So what is wrong now? A few days ago it works fine. I don't understand that. :/ Strange. That's what I do (verbatim), so it should work. Which "make" is being called? What is your DMC? Could you try it with *only* "X/dm/bin" in y

Re: Error by building druntime

2013-01-22 Thread Namespace
Maybe I should describe _exactly_ what I did to earn help. I make a new directory with: mkdir d then I wrote git clone git://github.com/D-Programming-Language/dmd.git git clone git://github.com/D-Programming-Language/druntime.git git clone git://github.com/D-Programming-Language/phobos.git dir and

S-Expressions

2013-01-22 Thread qznc
After "Atomic Updates" from rosettacode.org, here is "S-Expressions". Problem: http://rosettacode.org/wiki/S-Expressions Code: http://dpaste.dzfl.pl/fd485808 Comments, improvements?

Re: TDPL message passing: OwnerFailed?

2013-01-22 Thread Ali Çehreli
On 01/22/2013 09:04 AM, monarch_dodra wrote: I'm getting some errors with this program: I can not reproduce this problem on Linux. Not with -m64 nor with -m32. I don't think the following is necessary but it has been a workaround for me in the past: import core.thread; void main(string[]

Re: Atomic updates

2013-01-22 Thread bearophile
ixid: I note you always seem to use "in" in your functions and on reddit seemed to imply that this was the idiomatic way of using D yet I recall Jonathan M Davies posting that using "in" was a bad idea. I think "in" is supposed to be(come) idiomatic, because it's short, and it's supposed to

Re: Atomic updates

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 18:10:27 UTC, cal wrote: On Tuesday, 22 January 2013 at 09:47:25 UTC, monarch_dodra wrote: Avoids deadlock. imagine 2 threads: a: from 2 to 5. b: from 5 to 2. If both threads acquire their first lock, then you have a dead lock, and your program is basically dead

Re: Atomic updates

2013-01-22 Thread ixid
On Monday, 21 January 2013 at 20:35:16 UTC, bearophile wrote: qznc: Code: http://dpaste.dzfl.pl/e6615a53 Any comments or improvements? I have reformatted your code a little, according to the style used in all other D entries of RosettaCode: http://codepad.org/ceDyQ8lE The usage of a sink

Re: Atomic updates

2013-01-22 Thread cal
On Tuesday, 22 January 2013 at 09:47:25 UTC, monarch_dodra wrote: Avoids deadlock. imagine 2 threads: a: from 2 to 5. b: from 5 to 2. If both threads acquire their first lock, then you have a dead lock, and your program is basically dead. By always locking low first, you avoid the deadlock i

Re: Error by building druntime

2013-01-22 Thread Namespace
On Tuesday, 22 January 2013 at 15:10:14 UTC, Namespace wrote: On Tuesday, 22 January 2013 at 14:58:50 UTC, monarch_dodra wrote: On Tuesday, 22 January 2013 at 14:56:16 UTC, Namespace wrote: Hm, has really no one an idea what's wrong? I'm followed strict the steps that are described in the wiki.

Re: Atomic updates

2013-01-22 Thread bearophile
Second try at a translation of the third Go version. It seems to work correctly (comments welcome), but it seems slower: http://codepad.org/y1LnjLl0 Bye, bearophile

Re: TDPL message passing: OwnerFailed?

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 15:01:59 UTC, monarch_dodra wrote: TY. Gonna read everything. I'm not enjoying this. I'm getting some errors with this program: // import std.stdio, std.file; import std.concurrency; void main(string[] args) { auto iFile = File("input.txt", "r");

Re: Atomic updates

2013-01-22 Thread bearophile
In core.atomic I think there is what's needed, cas and atomicOp: I know what a cas is, but I don't have experience on this kind of coding. First try at a translation (doesn't work yet, and the global lock on buckets is missing still): import core.atomic: atomicLoad, atomicOp, cas; ...

Re: Atomic updates

2013-01-22 Thread bearophile
Martin Drasar: Wild guess, but couldn't it be because the ddoc documentation is inside version(CoreDdoc) and not processed? The question then becomes why is that version(CoreDdoc) used :-) Bye, bearophile

Re: Error by building druntime

2013-01-22 Thread Namespace
On Tuesday, 22 January 2013 at 14:58:50 UTC, monarch_dodra wrote: On Tuesday, 22 January 2013 at 14:56:16 UTC, Namespace wrote: Hm, has really no one an idea what's wrong? I'm followed strict the steps that are described in the wiki. Do you have the latest github dmd? Could just be that you p

Re: Atomic updates

2013-01-22 Thread Martin Drasar
On 22.1.2013 16:00, bearophile wrote: > Do you know why the site doesn't show the ddocs here? > http://dlang.org/phobos/core_atomic.html Wild guess, but couldn't it be because the ddoc documentation is inside version(CoreDdoc) and not processed? Martin

Re: TDPL message passing: OwnerFailed?

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 12:27:12 UTC, Martin Drasar wrote: Hi, wouldn't this help you? http://dlang.org/phobos/std_concurrency.html#.spawnLinked According to documentation: Executes the supplied function in a new context represented by Tid. This new context is linked to the calling

Re: Atomic updates

2013-01-22 Thread bearophile
monarch_dodra: D has attomic swap operations too, AFAIK. In core.atomic I think there is what's needed, cas and atomicOp: https://github.com/D-Programming-Language/druntime/blob/master/src/core/atomic.d Do you know why the site doesn't show the ddocs here? http://dlang.org/phobos/core_atomic.

Re: Error by building druntime

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 14:56:16 UTC, Namespace wrote: Hm, has really no one an idea what's wrong? I'm followed strict the steps that are described in the wiki. Do you have the latest github dmd? Could just be that you pulled the code at the exact moment it wasn't compiling.

Re: Error by building druntime

2013-01-22 Thread Namespace
Hm, has really no one an idea what's wrong? I'm followed strict the steps that are described in the wiki.

Re: TDPL message passing: OwnerFailed?

2013-01-22 Thread Ali Çehreli
On 01/22/2013 04:26 AM, Martin Drasar wrote: > On 22.1.2013 11:08, monarch_dodra wrote: >> I was trying to do a simple program to test message passing. > wouldn't this help you? > > http://dlang.org/phobos/std_concurrency.html#.spawnLinked The following chapter may be helpful as well: http://

Re: Atomic updates

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 14:10:14 UTC, qznc wrote: On Tuesday, 22 January 2013 at 10:27:58 UTC, bearophile wrote: The Go language has four different solutions, one of them is: http://rosettacode.org/wiki/Atomic_updates#Lock-free From the site: This version uses no locking for the phase

Re: Atomic updates

2013-01-22 Thread qznc
On Tuesday, 22 January 2013 at 10:27:58 UTC, bearophile wrote: The Go language has four different solutions, one of them is: http://rosettacode.org/wiki/Atomic_updates#Lock-free From the site: This version uses no locking for the phase where the two clients are updating the buckets. Instead i

Re: Atomic updates

2013-01-22 Thread bearophile
I have tried to scope the Mutex, but the D code gets a little slower, I don't know why: 5,6d5 < import std.typecons: scoped; < import std.traits: ReturnType; 19,22c17,19 < ReturnType!(scoped!Mutex) mtx; < alias this = value; < } < // pragma(msg, Bucket.sizeof); // 52 byt

Re: TDPL message passing: OwnerFailed?

2013-01-22 Thread Martin Drasar
On 22.1.2013 11:08, monarch_dodra wrote: > I was trying to do a simple program to test message passing. > > Basically, I have 1 owner, and 2 slave threads. > > I'm facing two problems: > > 1 ) First, I want the slaves to be informed of when the master dies in > an abnormal way. > > TDPL suggest

Re: Error by building druntime

2013-01-22 Thread Namespace
Hey, me again. I cloned dmd from git head and try to build it with: make -fwin32.mak release But I get these errors: dmc -c -Ibackend;tk -DMARS -cpp -D -g -DUNITTEST -e -wx -DDM_TARGET_CPU_X86=1 - I. backend\cgelem elerr, ^ elxxx.c(3) : Error: need explicit cast to conve

Re: Atomic updates

2013-01-22 Thread bearophile
I have modified a bit the second and third Go versions on Rosettacode, The changes on the Go versions are only on my local copies of the code. Bye, bearophile

Re: Atomic updates

2013-01-22 Thread bearophile
monarch_dodra: That's a good point, and I'm sure we could also have a version of D that could also do it that way. Someone is willing to create that second version for RosettaCode? I have modified a bit the second and third Go versions on Rosettacode, now there are 20 buckets and it shows th

Re: Atomic updates

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 10:27:58 UTC, bearophile wrote: I have modified a little the code on RosettaCode (no changes in the logic). monarch_dodra: Avoids deadlock. imagine 2 threads: a: from 2 to 5. b: from 5 to 2. If both threads acquire their first lock, then you have a dead lock,

Re: Operator overloading question

2013-01-22 Thread Timon Gehr
On 01/21/2013 07:53 PM, Ali Çehreli wrote: ... void foo(string s == "hello")() // ERROR; I don't think possible { // ... } void foo(string s : "hello")(){ // ... }

Re: Pull 1019

2013-01-22 Thread Namespace
It will remain the same until author of the pull request will actually take time to fix test errors or whatever fails there. AFAIR Brad is the one who should get most gratitude for that nice CI suite. Thanks, good to know. :)

Re: Atomic updates

2013-01-22 Thread bearophile
I have modified a little the code on RosettaCode (no changes in the logic). monarch_dodra: Avoids deadlock. imagine 2 threads: a: from 2 to 5. b: from 5 to 2. If both threads acquire their first lock, then you have a dead lock, and your program is basically dead. By always locking low fir

Re: Pull 1019

2013-01-22 Thread mist
On Tuesday, 22 January 2013 at 09:29:07 UTC, Namespace wrote: On Friday, 18 January 2013 at 13:13:03 UTC, Jacob Carlborg wrote: On 2013-01-18 14:07, Namespace wrote: Despite the danger that this annoy you probably: What about pull 1019 (https://github.com/D-Programming-Language/dmd/pull/1019)?

TDPL message passing: OwnerFailed?

2013-01-22 Thread monarch_dodra
I was trying to do a simple program to test message passing. Basically, I have 1 owner, and 2 slave threads. I'm facing two problems: 1 ) First, I want the slaves to be informed of when the master dies in an abnormal way. TDPL suggest OwnerFailed, but apparently, the out of band exception t

Re: Atomic updates

2013-01-22 Thread monarch_dodra
On Tuesday, 22 January 2013 at 09:26:25 UTC, cal wrote: On Tuesday, 22 January 2013 at 08:12:03 UTC, qznc wrote: On Tuesday, 22 January 2013 at 00:10:22 UTC, bearophile wrote: I suggest to put your code on Rosettacode now, and then we'll do the changes there... As you see in other answers, both

Re: Pull 1019

2013-01-22 Thread Namespace
On Friday, 18 January 2013 at 13:13:03 UTC, Jacob Carlborg wrote: On 2013-01-18 14:07, Namespace wrote: Despite the danger that this annoy you probably: What about pull 1019 (https://github.com/D-Programming-Language/dmd/pull/1019)? I'm still quite new with Git so I do not know exactly what "1

Re: Atomic updates

2013-01-22 Thread cal
On Tuesday, 22 January 2013 at 08:12:03 UTC, qznc wrote: On Tuesday, 22 January 2013 at 00:10:22 UTC, bearophile wrote: I suggest to put your code on Rosettacode now, and then we'll do the changes there... As you see in other answers, both me and monarch_dodra have other ideas for improvements.

Re: Atomic updates

2013-01-22 Thread qznc
On Tuesday, 22 January 2013 at 00:10:22 UTC, bearophile wrote: I suggest to put your code on Rosettacode now, and then we'll do the changes there... As you see in other answers, both me and monarch_dodra have other ideas for improvements. Ok, posted it. http://rosettacode.org/wiki/Atomic_upda