Re: Stack overflow

2012-06-23 Thread Namespace
On Friday, 22 June 2012 at 23:01:47 UTC, David wrote: Am 22.06.2012 23:11, schrieb Namespace: debugger), but my guess is that Namespace just doesn't know how to do that or that it's even possible - hence his frustration with not getting any information. Exactly. And I use VisualD and the

Re: Writing .di files

2012-06-23 Thread 1100110
On Fri, 22 Jun 2012 13:13:52 -0500, Minas Mina minas_mina1...@hotmail.co.uk wrote: I'm sorry, what I meant was how to interface to C code. Sorry for writing it in a bad way. Do I just declare the C code as extern and then link together with the C .lib/.o/.so file? (I'm in Ubuntu) What

Re: Stack overflow

2012-06-23 Thread David
Am 23.06.2012 07:27, schrieb Namespace: I would prefer NullPointer Exceptions and / or not null types rather than playing around with the debugger. That's the first step. Yeah but not implemented by a library.

Re: Stack overflow

2012-06-23 Thread Namespace
On Saturday, 23 June 2012 at 09:53:35 UTC, David wrote: Am 23.06.2012 07:27, schrieb Namespace: I would prefer NullPointer Exceptions and / or not null types rather than playing around with the debugger. That's the first step. Yeah but not implemented by a library. Not yet. ;)

phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
http://dlang.org/phobos/std_array.html#splitter The first thing I don't understand is why splitter is in /std.array/ and yet only works on /strings/. It is defined in terms of whitespace, and I don't understand how whitespace is well-defined for things besides text. Why wouldn't it be in

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 17:19:59 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: http://dlang.org/phobos/std_array.html#splitter The first thing I don't understand is why splitter is in /std.array/ and yet only works on /strings/. It is defined in terms of whitespace, and I don't

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
I'm realizing that if I want to remove exactly one line from a string of text and make no assumptions about the type of newline (\n or \r\n or \r) and without scanning the rest of the text then I'm not sure how to do this with a single call to phobos functions. I'd have to use indexOf and do

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 11:31 AM, simendsjo wrote: On Sat, 23 Jun 2012 17:19:59 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: http://dlang.org/phobos/std_array.html#splitter The first thing I don't understand is why splitter is in /std.array/ and yet only works on /strings/. It is defined in

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 17:39:55 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: On 06/23/2012 11:31 AM, simendsjo wrote: On Sat, 23 Jun 2012 17:19:59 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: http://dlang.org/phobos/std_array.html#splitter The first thing I don't

Re: Strange exception using threads

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 18:05:47 +0200, Minas Mina minas_mina1...@hotmail.co.uk wrote: I am using a secondary thread to send messages to it so it can print those messages. import std.stdio; import std.concurrency; void main() { auto low = 0, high = 10; auto tid =

Re: Strange exception using threads

2012-06-23 Thread Ali Çehreli
On 06/23/2012 09:05 AM, Minas Mina wrote: I am using a secondary thread to send messages to it so it can print those messages. std.concurrency.OwnerTerminated@std/concurrency.d(248): Owner terminated The OwnerTerminated exception is thrown when a worker attempts to receive a message to

Re: Strange exception using threads

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 18:29:37 +0200, simendsjo simend...@gmail.com wrote: auto tid = spawnLinked(writer); auto tid = spawn(writer); of course

Re: Strange exception using threads

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 18:29:50 +0200, Ali Çehreli acehr...@yahoo.com wrote: receive( (Tid id, int i) { writeln(Secondary thread: , i); }, (OwnerTerminated exc) // - as a message { done = true;

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 11:44 AM, simendsjo wrote: On Sat, 23 Jun 2012 17:39:55 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: On 06/23/2012 11:31 AM, simendsjo wrote: On Sat, 23 Jun 2012 17:19:59 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote:

Re: Strange exception using threads

2012-06-23 Thread Minas Mina
Thank you very much :) I like the you are done :) approach!

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 18:50:05 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: Looking for findSplit? http://dlang.org/phobos/std_algorithm.html#findSplit Cool, that's what I want! Now if I could find the elegant way to remove exactly one line from the text without scanning the

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 18:56:24 +0200, simendsjo simend...@gmail.com wrote: On Sat, 23 Jun 2012 18:50:05 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: Looking for findSplit? http://dlang.org/phobos/std_algorithm.html#findSplit Cool, that's what I want! Now if I could find the

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 01:02 PM, simendsjo wrote: On Sat, 23 Jun 2012 18:56:24 +0200, simendsjo simend...@gmail.com wrote: On Sat, 23 Jun 2012 18:50:05 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: Looking for findSplit? http://dlang.org/phobos/std_algorithm.html#findSplit Cool, that's what

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 01:24 PM, Chad J wrote: On 06/23/2012 01:02 PM, simendsjo wrote: On Sat, 23 Jun 2012 18:56:24 +0200, simendsjo simend...@gmail.com wrote: On Sat, 23 Jun 2012 18:50:05 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: Looking for findSplit?

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 19:52:32 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: As an additional note: I could probably do this easily if I had a function like findSplit where the predicate is used /instead/ of a delimiter. So like this: auto findSplit(alias pred = a, R)(R

Passing a ubyte[] to a function taking a 'ref ubyte[16]'

2012-06-23 Thread Johannes Pfau
I'm working on the new design for std.hash and I hit an interesting problem: The OOP interface has to take buffers as slices with unknown length, as the length differs between hashes and I have to put a common function declaration in a interface. So I have this: interface Digest {

Re: Passing a ubyte[] to a function taking a 'ref ubyte[16]'

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 20:23:26 +0200, Johannes Pfau nos...@example.com wrote: So how to pass a ubyte[] to a function expecting a ref ubyte[16] without allocating/using any extra memory (Not even stack)? This seems to work, but it's very ugly:

Re: Passing a ubyte[] to a function taking a 'ref ubyte[16]'

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 20:33:09 +0200, simendsjo simend...@gmail.com wrote: On Sat, 23 Jun 2012 20:23:26 +0200, Johannes Pfau nos...@example.com wrote: So how to pass a ubyte[] to a function expecting a ref ubyte[16] without allocating/using any extra memory (Not even stack)? This seems to

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 02:17 PM, simendsjo wrote: On Sat, 23 Jun 2012 19:52:32 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: As an additional note: I could probably do this easily if I had a function like findSplit where the predicate is used /instead/ of a delimiter. So like this: auto

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 20:41:29 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: Hey, thanks for doing all of that. I didn't expect you to write all of that. np Once I've established that the issue isn't just a lack of learning on my part, my subsequent objective is filling any

Learning asynchronous sockets in D (well actually C...)

2012-06-23 Thread Jarl André
The learning curve has been from like zero to something. I am still grasping for some fundamental knowledge that I need to fully get whats going on. Had to read documentation for sockets in C to understand anything at all. That says a lot. Coming from BufferedReader hell in Java and did never

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread simendsjo
On Sat, 23 Jun 2012 20:41:29 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: IMO the take away a single line thing should be accomplishable with a single concise expression This takes a range to match against, so much like startsWith: auto findSplitAny(Range, Ranges...)(Range data,

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 02:53 PM, simendsjo wrote: On Sat, 23 Jun 2012 20:41:29 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: Hey, thanks for doing all of that. I didn't expect you to write all of that. np Once I've established that the issue isn't just a lack of learning on my part, my

Address of TLS variables

2012-06-23 Thread Alex Rønne Petersen
Hi, Does taking the address of a TLS variable and passing it to other threads have defined semantics? I would assume it results in a pointer to the thread's instance of the TLS variable (which makes sense), but is passing it to other threads OK? Does the language guarantee this? -- Alex

Re: phobos and splitting things... but not with whitespace.

2012-06-23 Thread Chad J
On 06/23/2012 03:41 PM, simendsjo wrote: On Sat, 23 Jun 2012 20:41:29 +0200, Chad J chadjoan@__spam.is.bad__gmail.com wrote: IMO the take away a single line thing should be accomplishable with a single concise expression This takes a range to match against, so much like startsWith: auto

Re: Address of TLS variables

2012-06-23 Thread Timon Gehr
On 06/23/2012 09:51 PM, Alex Rønne Petersen wrote: Hi, Does taking the address of a TLS variable and passing it to other threads have defined semantics? I would assume it results in a pointer to the thread's instance of the TLS variable (which makes sense), I'd assume that it results in a

Re: Stack overflow

2012-06-23 Thread Namespace
So here i proudly present my Ref struct (2.0 ;)) http://dpaste.dzfl.pl/905e1d3d So, any suggestions, further ideas or criticism?

Re: Stack overflow

2012-06-23 Thread Namespace
BTW: Any tries to declare @disable this(typeof(null)); end with the same message Stack overflow...

Re: Stack overflow

2012-06-23 Thread Jonathan M Davis
On Saturday, June 23, 2012 07:27:56 Namespace wrote: I would prefer NullPointer Exceptions and / or not null types rather than playing around with the debugger. That's the first step. NullPointerExceptions (well, they'd end up being NullPointersErrors) will _never_ happen. Walter is

Re: Passing a ubyte[] to a function taking a 'ref ubyte[16]'

2012-06-23 Thread Jonathan M Davis
On Saturday, June 23, 2012 20:23:26 Johannes Pfau wrote: I'm working on the new design for std.hash and I hit an interesting problem: The OOP interface has to take buffers as slices with unknown length, as the length differs between hashes and I have to put a common function declaration in

aa.remove in a destructor

2012-06-23 Thread Ellery Newcomer
this code: class X{ string[string] s; this() { s[s] = S; } ~this() { s.remove(s); } } void main() { X x = new X(); } produces this: core.exception.InvalidMemoryOperationError because the aa is calling gc_free during a collection, apparently. Should I

Re: aa.remove in a destructor

2012-06-23 Thread BLM768
I've been having the same problem as well, but I never figured out the link to the remove() call in the destructor. The only solution I've found is to use GC.removeRoot() on the table, but it's an untested and potentially dangerous solution.