two design questions

2011-02-06 Thread spir
Hello D-istos, I am currenty implementing a kind of lexing toolkit. First time I do that. Below are design questions on the topic. Also, I would like to know whether you think such a module would be useful for th community od D programmers. And for which advantages, knowing that D directly

three little issues

2011-02-06 Thread spir
Hello, Here are three little issues I faced while implemented a lexing toolkit (see other post). 1. Regex match Let us say there are three natures or modes of lexeme: * SKIP: not even kept, just matched and dropped (eg optional spacing) * MARK: kept, but slice is irrelevant data (eg all

Maximum Number of Threads?

2011-02-06 Thread d coder
Greetings Is there a limit on the maximum number of threads that can be spawned? Or does it just depend on the value in /proc/sys/kernel/threads-max on a linux system? Regards - Cherry

Re: three little issues

2011-02-06 Thread bearophile
spir: 2. reference escape 3. implicite deref The situation is easy to understand once you know how generally what a stack frame is and how C functions are called: http://en.wikipedia.org/wiki/Stack_frame The D call stack is a contiguous-allocated backwards-single-linked list of

Re: New to D: parse a binary file

2011-02-06 Thread Jesse Phillips
scottrick Wrote: T[] rawRead(T)(T[] buffer); I understand that T is generic type, but I am not sure of the meaning of the (T) after the method name. That T is defining the symbol to represent the generic type. It can have more than one and D provides other things like aliases... Another

Re: three little issues

2011-02-06 Thread spir
On 02/06/2011 02:13 PM, bearophile wrote: Before a D function starts, a stack frame is created. It will contain your stack-allocated struct instance. When the function ends its stack frame is destroyed virtually by moving a stack pointer, so the struct may be overwritten by other things, like

Re: three little issues

2011-02-06 Thread bearophile
spir: But this does not explain why the compiler refuses: // 1 auto s = S(data); return s; and accepts: // 2 return (S(data)); or does it? Accepting the second is a bug in the escape analysis done by the front-end, I think. But see also what Walter has

Debugging D?

2011-02-06 Thread Sean Eskapp
Are debug symbols compiled with -gc stored in a separate file? Visual Studio refuses to debug my things, and windbg seems to be remarkably unhelpful.

Re: New to D: parse a binary file

2011-02-06 Thread scottrick
Thanks, your post was very helpful. Two more questions (probably related): Where is the function 'format' defined? Also, what is that 'unittest' block? It compiles fine as is, but if I refer to format outside of unittest, it will not compile. Also, if I compile and run your example, it

Re: New to D: parse a binary file

2011-02-06 Thread bearophile
scottrick: Where is the function 'format' defined? You need to add at the top of the module: import std.conv: format; Or: import std.conv; Also, what is that 'unittest' block? It compiles fine as is, but if I refer to format outside of unittest, it will not compile. Also, if I compile

std.concurrency immutable classes...

2011-02-06 Thread Tomek Sowiński
... doesn't work. class C {} thisTid.send(new immutable(C)()); receive((immutable C) { writeln(got it!); }); This throws: core.exception.AssertError@/usr/include/d/dmd/phobos/std/variant.d(285): immutable(C) And when I go for Rebindable, I get Aliases to mutable thread-local data not

Re: Debugging D?

2011-02-06 Thread Trass3r
Are debug symbols compiled with -gc stored in a separate file? Visual Studio refuses to debug my things Nope. Plus you need to use cv2pdb to debug with Visual

Re: New to D: parse a binary file

2011-02-06 Thread Mafi
Am 06.02.2011 19:38, schrieb Jesse Phillips: scottrick Wrote: T[] rawRead(T)(T[] buffer); I understand that T is generic type, but I am not sure of the meaning of the (T) after the method name. That T is defining the symbol to represent the generic type. It can have more than one and D

Re: Debugging D?

2011-02-06 Thread Robert Clipsham
On 06/02/11 20:29, Sean Eskapp wrote: Are debug symbols compiled with -gc stored in a separate file? Visual Studio refuses to debug my things, and windbg seems to be remarkably unhelpful. I suggest you take a look at VisualD if you're using visual studio, it will handle converting debug info

Re: Debugging D?

2011-02-06 Thread Sean Eskapp
== Quote from Robert Clipsham (rob...@octarineparrot.com)'s article On 06/02/11 20:29, Sean Eskapp wrote: Are debug symbols compiled with -gc stored in a separate file? Visual Studio refuses to debug my things, and windbg seems to be remarkably unhelpful. I suggest you take a look at VisualD

Re: Maximum Number of Threads?

2011-02-06 Thread Jonathan M Davis
On Sunday 06 February 2011 05:05:24 d coder wrote: Greetings Is there a limit on the maximum number of threads that can be spawned? Or does it just depend on the value in /proc/sys/kernel/threads-max on a linux system? Barring any bugs which manage to keep threads alive too long, it's

Re: std.concurrency immutable classes...

2011-02-06 Thread Jonathan M Davis
On Sunday 06 February 2011 13:55:36 Tomek Sowiński wrote: ... doesn't work. class C {} thisTid.send(new immutable(C)()); receive((immutable C) { writeln(got it!); }); This throws: core.exception.AssertError@/usr/include/d/dmd/phobos/std/variant.d(285): immutable(C) And when I go for

Starting with D

2011-02-06 Thread Julius
Hi there, i'm all new to D but not new to programming in general. I'd like to try D but i didn't find a nice tutorial yet. I don't want to read a whole book, I just want to get the basics so I can start. Can you help me find something like that? Best regards, Julius

Re: Starting with D

2011-02-06 Thread Caligo
On Sun, Feb 6, 2011 at 5:35 PM, Julius n0r3...@web.de wrote: Hi there, i'm all new to D but not new to programming in general. I'd like to try D but i didn't find a nice tutorial yet. I don't want to read a whole book, I just want to get the basics so I can start. Can you help me find

Re: std.concurrency immutable classes...

2011-02-06 Thread Michel Fortin
On 2011-02-06 16:55:36 -0500, Tomek Sowiński j...@ask.me said: ... doesn't work. class C {} thisTid.send(new immutable(C)()); receive((immutable C) { writeln(got it!); }); This throws: core.exception.AssertError@/usr/include/d/dmd/phobos/std/variant.d(285): immutable(C) And when I go for

Re: std.concurrency immutable classes...

2011-02-06 Thread Michel Fortin
On 2011-02-06 20:09:56 -0500, Michel Fortin michel.for...@michelf.com said: I just made this pull request today: https://github.com/D-Programming-Language/dmd/pull/ That should have been: https://github.com/D-Programming-Language/dmd/pull/3 -- Michel Fortin michel.for...@michelf.com

Why non-@property functions don't need parentheses

2011-02-06 Thread %u
Hi, I was wondering, why are we allowed to omit parentheses when calling functions with no arguments, when they are not @properties? Is there a good reason for relaxing the language rules like this? Thanks!

Re: Why non-@property functions don't need parentheses

2011-02-06 Thread Jonathan M Davis
On Sunday 06 February 2011 20:38:29 %u wrote: Hi, I was wondering, why are we allowed to omit parentheses when calling functions with no arguments, when they are not @properties? Is there a good reason for relaxing the language rules like this? Because the compiler is not in line with TDPL

Re: Why non-@property functions don't need parentheses

2011-02-06 Thread Simen kjaeraas
%u wfunct...@hotmail.com wrote: Hi, I was wondering, why are we allowed to omit parentheses when calling functions with no arguments, when they are not @properties? Is there a good reason for relaxing the language rules like this? This behavior is deprecated, but other features have had

Re: Using D libs in C

2011-02-06 Thread GreatEmerald
All right, found out how to make it compile. There are two ways: 1) Using DMD for the D part, DMC for the C part and combining them. This is the batch file I use for that: dmd -c -lib dpart.d dmc cpart.c dpart.lib phobos.lib 2) Using DMD for the D part, DMC for the C part, DMD for combining

Re: Using D libs in C

2011-02-06 Thread GreatEmerald
Hmm, no, it won't work right on Linux for some reason. This is the output: /usr/lib/gcc/x86_64-linux-gnu/4.3.2/../../../libphobos2.a(deh2_4e7_525.o): In function `_D2rt4deh213__eh_finddataFPvZPS2rt4deh213DHandlerTable':