Re: Exiting blocked threads (socket.accept)

2013-03-27 Thread Ali Çehreli
On 03/27/2013 02:38 PM, Tim wrote: > are there any information/examples about message passing? The following chapter is about the std.concurrency module of Phobos: http://ddili.org/ders/d.en/concurrency.html Some of the examples in there send a special 'struct Exit' message to tell the work

Re: Exiting blocked threads (socket.accept)

2013-03-27 Thread Tim
On Wednesday, 27 March 2013 at 20:16:39 UTC, Martin Drašar wrote: Dne 27.3.2013 18:51, Tim napsal(a): That works as expected, except the fact that pressing CTRL+C which stops the while(!stopServer) doesn't terminate the mainloop in my Connection-class (run()-method). This thread is blocked bec

Re: Question about auto ref

2013-03-27 Thread Namespace
I'm surprised that this is ignored and no one seems to be interested in a possible solution. Is it me? Or are my efforts a complete mischief?

Re: Exiting blocked threads (socket.accept)

2013-03-27 Thread Martin Drašar
Dne 27.3.2013 18:51, Tim napsal(a): That works as expected, except the fact that pressing CTRL+C which stops the while(!stopServer) doesn't terminate the mainloop in my Connection-class (run()-method). This thread is blocked because of the receive()-method... but how can I force this thread to ex

Re: Exiting blocked threads (socket.accept)

2013-03-27 Thread Sean Kelly
Have each thread select() on the read end of a pipe that the main thread writes to when it wants to trigger a wakeup--write() is legal even in signal handlers.

Re: When to call setAssertHandler?

2013-03-27 Thread Sean Kelly
On Mar 26, 2013, at 11:37 AM, Benjamin Thaut wrote: > Am 25.03.2013 23:49, schrieb Sean Kelly: >> On Mar 22, 2013, at 2:58 AM, Benjamin Thaut wrote: >> >>> So I want to install my own assertHandler. The problem is, that even if I >>> call "setAssetHandler" in a shared module constructor, and t

Exiting blocked threads (socket.accept)

2013-03-27 Thread Tim
Hi guys, I'm doing the following: class Connection : Thread { private Socket pSocket; void run() { ptrdiff_t received; ubyte[0x10] buffer; mainloop: while(true) { received = pSocket.receive(b

Re: Text from the Internet page

2013-03-27 Thread SaltySugar
On Wednesday, 27 March 2013 at 12:03:59 UTC, bearophile wrote: SaltySugar: How to get a piece of text from the Internet page with D code? By lines: http://rosettacode.org/wiki/Web_scraping#D Whole: http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity#D Bye, bearophile Tha

Re: Orange lib help

2013-03-27 Thread Jacob Carlborg
On 2013-03-26 16:34, Dan wrote: Hi - I get some errors from this simple code: class Class_a { double[2][2] ob; } class Class_b : Class_a { int obb;} Serializer.register!(Class_b); The error is: Error: variable orange.serialization.Serializer.Serializer.serializeArray!(inout(double[2LU][2LU

Re: A little of coordination for Rosettacode

2013-03-27 Thread bearophile
Jos van Uden: Output on my system: C:\test Rosetta Enjoy Code C:\test Code Enjoy Rosetta Thank you for your test, I will replace the Rosettacode one with the nicer version. I don't know why the second doesn't work correctly on my system, while the first works. Bye, bearophile

Re: A little of coordination for Rosettacode

2013-03-27 Thread Jos van Uden
On 27-3-2013 15:17, Jos van Uden wrote: On 27-3-2013 0:20, bearophile wrote: This task has just a Tango entry: http://rosettacode.org/wiki/Concurrent_computing So I am writing a Phobos version. This seems to work as requested: import std.stdio, std.random, std.parallelism, core.thread, core.

Re: A little of coordination for Rosettacode

2013-03-27 Thread Jos van Uden
On 27-3-2013 0:20, bearophile wrote: This task has just a Tango entry: http://rosettacode.org/wiki/Concurrent_computing So I am writing a Phobos version. This seems to work as requested: import std.stdio, std.random, std.parallelism, core.thread, core.time; void main() { foreach (m; ["E

Re: Question about auto ref

2013-03-27 Thread Namespace
So I changed it into 'ref&'. Quick example: [code] void bar1(ref& A a) { } // OK void bar2(ref &A a) { } // OK void bar21(&A a) { } // Error: '&' can only be used in combination with 'ref'. void bar22(& A a) { } // Error: '&' can only be used in combination with 'ref'. void bar3(ref const& A

Re: Text from the Internet page

2013-03-27 Thread bearophile
SaltySugar: How to get a piece of text from the Internet page with D code? By lines: http://rosettacode.org/wiki/Web_scraping#D Whole: http://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_popularity#D Bye, bearophile

static enum member of incomplete type, valid or not?

2013-03-27 Thread TommiT
I'd like to get a definite answer to whether the following code is valid or not: struct S { int v = 42; this(int val) { v = val + 1; } enum s = S(4); } void main() { static assert(S.s.v == 5); } There's a bug report about it: http://d.puremagic.com/issues/show_bug.cgi?id=9397

Re: Text from the Internet page

2013-03-27 Thread Andrea Fontana
On Wednesday, 27 March 2013 at 10:43:44 UTC, SaltySugar wrote: How to get a piece of text from the Internet page with D code? Something like this: http://dlang.org/phobos/std_net_curl.html#get ?

Re: Text from the Internet page

2013-03-27 Thread Alexandr Druzhinin
27.03.2013 17:43, SaltySugar пишет: How to get a piece of text from the Internet page with D code? Its totally depends on context you are workin. For example you can use D as script and by means of wget to get the whole page and then parse it with sed. Also you can use curl and use D as program

Text from the Internet page

2013-03-27 Thread SaltySugar
How to get a piece of text from the Internet page with D code?

Re: Question about auto ref

2013-03-27 Thread Namespace
On Wednesday, 27 March 2013 at 09:10:35 UTC, Minas Mina wrote: auto in? in ref? in ref was suggested by Kenji and rejected by Jonathan. What should auto in mean? auto const scope? I have to say that I like ref&, it's the best of two worlds. :) We need a clear statement so someone can finally b

Re: Question about auto ref

2013-03-27 Thread Minas Mina
auto in? in ref?

Re: Orange lib help

2013-03-27 Thread Dan
On Tuesday, 26 March 2013 at 19:35:51 UTC, Jacob Carlborg wrote: I'll take a look. Which compiler and version are you using? DMD64 D Compiler v2.062 ubuntu 64 bit thanks!

Re: how to parse mangled/demangled name into function name, arguments etc.

2013-03-27 Thread Jacob Carlborg
On 2013-03-27 08:17, Jacob Carlborg wrote: There's core.demangle, but that won't give you an AST and it will probably fail in some cases. I would try and modify core.demangle to produce an AST instead of a string. Perhaps this old project has something useful: http://flectioned.kuehne.cn/ I a

Re: how to parse mangled/demangled name into function name, arguments etc.

2013-03-27 Thread Jacob Carlborg
On 2013-03-26 22:17, Timothee Cour wrote: demangle D15bootstrap_utils4util15replace_macros2FKHAyaAyaAyaZAya immutable(char)[] bootstrap_utils.util.replace_macros2(ref immutable(char)[][immutable(char)[]], immutable(char)[]) I want to obtain function name, arguments, etc (eg AST as json output