Serious bug in TypeInfo_Array (Was: Re: Need help locating AA bug)

2012-02-28 Thread H. S. Teoh
Alright, so I made a fool of myself in my last post by not looking for the class hierarchy of TypeInfo in object.d. But now I've found the cause of the inconsistent hash problem. For an int[], the typeid is TypeInfo_Ai. Here's the implementation of TypeInfo_Ai.getHash(): override hash_t getHa

Re: Lexer and parser generators using CTFE

2012-02-28 Thread Nick Sabalausky
"Nick Sabalausky" wrote in message news:jikcit$201o$1...@digitalmars.com... > > Hmm, maybe I need to think about what it would take to make Goldie able to > parse at compile-time... > Just gave it a quick shot. It was looking like it might not be too bad, but then I hit: Assertion failure: 'c

Re: Lexer and parser generators using CTFE

2012-02-28 Thread bcs
On 02/28/2012 08:23 AM, mist wrote: Something similar to Boost::Spirit2 but with sane syntax and better debugging would have been awesome. How about not having to encode the syntax as arithmetic expressions? D can do string parsing of eBNF at compile time if you want that.

Re: Lexer and parser generators using CTFE

2012-02-28 Thread bcs
On 02/27/2012 11:59 PM, Andrei Alexandrescu wrote: I'm starting a new thread on this because I think the matter is of strategic importance. We all felt for a long time that there's a lot of potential in CTFE, and potential applications have been discussed more than a few times, ranging from form

Re: Lexer and parser generators using CTFE

2012-02-28 Thread Nick Sabalausky
"Nick Sabalausky" wrote in message news:jikcca$1vq7$1...@digitalmars.com... > "H. S. Teoh" wrote in message > news:mailman.215.1330472867.24984.digitalmar...@puremagic.com... >> On Tue, Feb 28, 2012 at 10:03:42PM +0100, Martin Nowak wrote: >> [...] >>> I won't deny that the combination of CTFE

Re: Lexer and parser generators using CTFE

2012-02-28 Thread Nick Sabalausky
"H. S. Teoh" wrote in message news:mailman.215.1330472867.24984.digitalmar...@puremagic.com... > On Tue, Feb 28, 2012 at 10:03:42PM +0100, Martin Nowak wrote: > [...] >> I won't deny that the combination of CTFE text processing and static >> introspection could improve on this. It could be made m

Re: Curl on Windows

2012-02-28 Thread Brad Anderson
On Tuesday, 28 February 2012 at 21:36:28 UTC, Walter Bright wrote: On 2/26/2012 6:39 PM, Brad Anderson wrote: If phobos can include zlib, I see no reason it couldn't include libcurl. Yes, we do include zlib, but I don't think that is a precedent we should follow. Including such third party li

Re: Curl on Windows

2012-02-28 Thread Brad Anderson
On Wednesday, 29 February 2012 at 00:53:55 UTC, Kapps wrote: On Tuesday, 28 February 2012 at 21:36:28 UTC, Walter Bright wrote: On 2/26/2012 6:39 PM, Brad Anderson wrote: If phobos can include zlib, I see no reason it couldn't include libcurl. Yes, we do include zlib, but I don't think that i

Re: [OT] A Note on Lazy Pure Functional Programming

2012-02-28 Thread bearophile
Manfred Nowak: > Satnam Singh [http://research.microsoft.com/en-us/people/satnams/] > writes: > > > Not only do lazy pure functional programmers know the cost of > > nothing, they don't know _when_ they know the cost of nothing. > > on the time (several hours) needed to find and fix a space lea

[OT] A Note on Lazy Pure Functional Programming

2012-02-28 Thread Manfred Nowak
Satnam Singh [http://research.microsoft.com/en-us/people/satnams/] writes: > Not only do lazy pure functional programmers know the cost of > nothing, they don't know _when_ they know the cost of nothing. on the time (several hours) needed to find and fix a space leak by Simon Marlow [http://rese

Re: Lexer and parser generators using CTFE

2012-02-28 Thread d coder
> > > > On Wednesday, February 29, 2012 02:16:12 Christopher Bergqvist wrote: > > > I agree that the current direction of D in this area is impressive. > > > However, I fail to see a killer-feature in generating a lexer-parser > > > generator at compile-time instead of run-time. > > > > CTFE parsi

Re: Need help locating AA bug

2012-02-28 Thread H. S. Teoh
On Tue, Feb 28, 2012 at 12:04:45PM -0800, Walter Bright wrote: > On 2/28/2012 7:20 AM, H. S. Teoh wrote: > >That's strange, because I'm clearly seeing a difference in hash > >value. Calling map1's keyti.getHash(key) yields a different value > >from map2's keyti.getHash(key). > > The thing to do t

Re: Lexer and parser generators using CTFE

2012-02-28 Thread H. S. Teoh
On Tue, Feb 28, 2012 at 08:25:21PM -0500, Jonathan M Davis wrote: > On Wednesday, February 29, 2012 02:16:12 Christopher Bergqvist wrote: > > I agree that the current direction of D in this area is impressive. > > However, I fail to see a killer-feature in generating a lexer-parser > > generator at

Re: Lexer and parser generators using CTFE

2012-02-28 Thread James Miller
On 29 February 2012 14:16, Christopher Bergqvist wrote: > On Tuesday, 28 February 2012 at 08:36:13 UTC, CTFE-4-the-win wrote: >> >> On Tuesday, 28 February 2012 at 07:59:16 UTC, Andrei Alexandrescu >> wrote: >>> >>> I'm starting a new thread on this because I think the matter is of >>> strategic i

Re: Lexer and parser generators using CTFE

2012-02-28 Thread Piotr Szturmaj
Jonathan M Davis wrote: On Wednesday, February 29, 2012 02:16:12 Christopher Bergqvist wrote: I agree that the current direction of D in this area is impressive. However, I fail to see a killer-feature in generating a lexer-parser generator at compile-time instead of run-time. A run-time genera

Re: Lexer and parser generators using CTFE

2012-02-28 Thread Jonathan M Davis
On Wednesday, February 29, 2012 02:16:12 Christopher Bergqvist wrote: > I agree that the current direction of D in this area is > impressive. However, I fail to see a killer-feature in > generating a lexer-parser generator at compile-time instead of > run-time. > > A run-time generator would benef

Re: Lexer and parser generators using CTFE

2012-02-28 Thread Christopher Bergqvist
On Tuesday, 28 February 2012 at 08:36:13 UTC, CTFE-4-the-win wrote: On Tuesday, 28 February 2012 at 07:59:16 UTC, Andrei Alexandrescu wrote: I'm starting a new thread on this because I think the matter is of strategic importance. We all felt for a long time that there's a lot of potential in

Re: Need help locating AA bug

2012-02-28 Thread H. S. Teoh
On Tue, Feb 28, 2012 at 12:04:45PM -0800, Walter Bright wrote: > On 2/28/2012 7:20 AM, H. S. Teoh wrote: > >That's strange, because I'm clearly seeing a difference in hash > >value. Calling map1's keyti.getHash(key) yields a different value > >from map2's keyti.getHash(key). > > The thing to do t

Re: Curl on Windows

2012-02-28 Thread Kapps
On Tuesday, 28 February 2012 at 21:36:28 UTC, Walter Bright wrote: On 2/26/2012 6:39 PM, Brad Anderson wrote: If phobos can include zlib, I see no reason it couldn't include libcurl. Yes, we do include zlib, but I don't think that is a precedent we should follow. Including such third party li

Re: [RFC] Ini parser

2012-02-28 Thread Stewart Gordon
On 27/02/2012 14:20, bioinfornatics wrote: the code support default .ini spec and in more allow to have subsection Where is this format called "default .ini" defined exactly? And where is the superset of "default .ini" that has subsections defined exactly? Stewart.

Re: Lexer and parser generators using CTFE

2012-02-28 Thread H. S. Teoh
On Tue, Feb 28, 2012 at 10:03:42PM +0100, Martin Nowak wrote: [...] > I won't deny that the combination of CTFE text processing and static > introspection could improve on this. It could be made more feasible by > some conventions, e.g. parse result always uses structs or classes and > built-in arr

Re: John Carmack applauds D's pure attribute

2012-02-28 Thread Klaim - Joël Lamotte
As a (not as experienced as other) game developer, I'd like to share my point of view (again). 1. smart pointer vs GC war isn't the point, it's a knowledge & implementation war and isn't related to languages that allow both (as C++ & D). 2. C++ base code is just there and ready to be used. Only be

Re: Curl on Windows

2012-02-28 Thread Brad Anderson
On Tue, Feb 28, 2012 at 2:36 PM, Walter Bright wrote: > On 2/26/2012 6:39 PM, Brad Anderson wrote: > >> If phobos can include zlib, I see no reason it couldn't include libcurl. >> > > Yes, we do include zlib, but I don't think that is a precedent we should > follow. Including such third party libr

Re: Curl on Windows

2012-02-28 Thread Walter Bright
On 2/26/2012 6:39 PM, Brad Anderson wrote: If phobos can include zlib, I see no reason it couldn't include libcurl. Yes, we do include zlib, but I don't think that is a precedent we should follow. Including such third party libraries is potentially a large support burden and source of conflic

Re: Lexer and parser generators using CTFE

2012-02-28 Thread Martin Nowak
On Tue, 28 Feb 2012 21:02:24 +0100, H. S. Teoh wrote: On Tue, Feb 28, 2012 at 07:46:04PM +0100, Martin Nowak wrote: [...] I wrote a generic lexer generator some time ago. It already let to some compiler O(N^2) optimizations, because the token declarations sneak into the mangling :(. I also f

Re: Lexer and parser generators using CTFE

2012-02-28 Thread deadalnix
Le 28/02/2012 21:02, H. S. Teoh a écrit : OTOH, perhaps once we start writing a lexer/parser generator, that will force us to fix the I/O and allocator system. Without a good project to motivate us to fix these tedious issues, it seems that we just lose inspiration to do it after a while. std.

Re: Lexer and parser generators using CTFE

2012-02-28 Thread H. S. Teoh
On Tue, Feb 28, 2012 at 11:52:52PM +0400, Dmitry Olshansky wrote: > On 28.02.2012 22:46, Martin Nowak wrote: > >On Tue, 28 Feb 2012 08:59:21 +0100, Andrei Alexandrescu > > wrote: [...] > >>We need to have a easy-to-use, complete, seamless, and efficient > >>lexer-parser generator combo in Phobos, p

Re: Need help locating AA bug

2012-02-28 Thread Walter Bright
On 2/28/2012 7:20 AM, H. S. Teoh wrote: That's strange, because I'm clearly seeing a difference in hash value. Calling map1's keyti.getHash(key) yields a different value from map2's keyti.getHash(key). The thing to do then is look at those two getHash functions, and see how they are computing

Re: Lexer and parser generators using CTFE

2012-02-28 Thread H. S. Teoh
On Tue, Feb 28, 2012 at 07:46:04PM +0100, Martin Nowak wrote: [...] > I wrote a generic lexer generator some time ago. > It already let to some compiler O(N^2) optimizations, because the token > declarations sneak into the mangling :(. > I also finally added a workaround for a remaining CTFE bug (#

Re: John Carmack applauds D's pure attribute

2012-02-28 Thread Martin Nowak
On Tue, 28 Feb 2012 09:30:12 +0100, Timon Gehr wrote: On 02/27/2012 03:42 PM, Martin Nowak wrote: ... https://gist.github.com/1920202 Neat. Possible improvement (if I understand your code correctly): Don't add the GC range if all possible aliasing is through Ptr. I hope I did that. impor

Re: Lexer and parser generators using CTFE

2012-02-28 Thread Dmitry Olshansky
On 28.02.2012 22:46, Martin Nowak wrote: On Tue, 28 Feb 2012 08:59:21 +0100, Andrei Alexandrescu wrote: I'm starting a new thread on this because I think the matter is of strategic importance. We all felt for a long time that there's a lot of potential in CTFE, and potential applications have

Re: Lexer and parser generators using CTFE

2012-02-28 Thread Martin Nowak
On Tue, 28 Feb 2012 08:59:21 +0100, Andrei Alexandrescu wrote: I'm starting a new thread on this because I think the matter is of strategic importance. We all felt for a long time that there's a lot of potential in CTFE, and potential applications have been discussed more than a few time

Re: Curl on Windows

2012-02-28 Thread Brad Anderson
On Mon, Feb 27, 2012 at 11:45 PM, igeek wrote: > Could anybody explain why you want to include curl in Phobos? Maybe Phobos > have some native function that allow to do some thing that curl are doing? > It's already in Phobos as part of std.net.curl. It's just not very usable on Windows yet. C

Re: Lexer and parser generators using CTFE

2012-02-28 Thread mist
Something similar to Boost::Spirit2 but with sane syntax and better debugging would have been awesome.

Re: Lexer and parser generators using CTFE

2012-02-28 Thread H. S. Teoh
On Tue, Feb 28, 2012 at 01:59:21AM -0600, Andrei Alexandrescu wrote: > I'm starting a new thread on this because I think the matter is of > strategic importance. +1. > We all felt for a long time that there's a lot of potential in CTFE, > and potential applications have been discussed more than

Re: Need help locating AA bug

2012-02-28 Thread H. S. Teoh
On Mon, Feb 27, 2012 at 09:15:45PM -0800, Walter Bright wrote: > On 2/27/2012 5:28 PM, H. S. Teoh wrote: > >1) Why does map2's internal TypeInfo get set to int[] instead of > >const(int)[]? > > There shouldn't be any difference, as far as aa's go. > > >2) Why does map1[key] use int[]'s version of

Re: Lexer and parser generators using CTFE

2012-02-28 Thread bls
On 02/28/2012 12:36 AM, CTFE-4-the-win wrote: We need to have a easy-to-use, complete, seamless, and efficient lexer-parser generator combo in Phobos, pronto. The lexer itself could use a character-level PEG or a classic automaton, and emit tokens for consumption by a parser generator. The two sh

Re: Lexer and parser generators using CTFE

2012-02-28 Thread Hisayuki Mima
(2012/02/28 16:59), Andrei Alexandrescu wrote: I'm starting a new thread on this because I think the matter is of strategic importance. We all felt for a long time that there's a lot of potential in CTFE, and potential applications have been discussed more than a few times, ranging from formatti

Re: Compile Time D Expression Parser?

2012-02-28 Thread Dmitry Olshansky
On 28.02.2012 9:19, Hisayuki Mima wrote: (2012/02/28 2:22), Dmitry Olshansky wrote: OK, does it check for Left recursive grammars? No, it doesn't. So currently left recursive grammar causes infinite loop. I know the way to deal with the left recursive grammar well which is using memoization, b

Re: foreach by value iteration

2012-02-28 Thread Peter Alexander
On Tuesday, 28 February 2012 at 01:56:48 UTC, bearophile wrote: Peter Alexander: C# isn't the same. If you iterate over structs you cannot modify the iteration variable. You have to explicitly copy. C# developers are old wise foxes, again :o) My respect for them grows some more every year.

Re: Lexer and parser generators using CTFE

2012-02-28 Thread CTFE-4-the-win
On Tuesday, 28 February 2012 at 07:59:16 UTC, Andrei Alexandrescu wrote: I'm starting a new thread on this because I think the matter is of strategic importance. We all felt for a long time that there's a lot of potential in CTFE, and potential applications have been discussed more than a few

Re: John Carmack applauds D's pure attribute

2012-02-28 Thread Timon Gehr
On 02/27/2012 03:42 PM, Martin Nowak wrote: ... https://gist.github.com/1920202 Neat. Possible improvement (if I understand your code correctly): Don't add the GC range if all possible aliasing is through Ptr. I hope I did that. import smart_ptr; struct S{ Ptr!int a; Ptr!double b;

Lexer and parser generators using CTFE

2012-02-28 Thread Andrei Alexandrescu
I'm starting a new thread on this because I think the matter is of strategic importance. We all felt for a long time that there's a lot of potential in CTFE, and potential applications have been discussed more than a few times, ranging from formatting strings parsed to DSLs and parser generato