Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-16 Thread Jacob Carlborg
On 2012-03-15 23:59, foobar wrote: On Thursday, 15 March 2012 at 10:39:04 UTC, Steven Schveighoffer wrote: Why would that pose a problem to DMD? object.d is a regular D module and D provides a public import feature. If that fails for some modules it should be considered a bug in the compiler.

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread foobar
On Wednesday, 14 March 2012 at 23:14:42 UTC, H. S. Teoh wrote: Alright, I've finished the basic functionality of my AA implementation. I still haven't solved that problem with using suffixless string literals to index X[dstring], so you'll have to write aa[abcd] instead of just aa[abc]. But I

Re: Replacing AA's in druntime

2012-03-15 Thread Dmitry Olshansky
On 15.03.2012 2:44, Jakob Bornecrantz wrote: On Wednesday, 14 March 2012 at 09:07:40 UTC, Dmitry Olshansky wrote: On 14.03.2012 6:39, Jakob Bornecrantz wrote: On Wednesday, 14 March 2012 at 00:52:32 UTC, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready

Re: Replacing AA's in druntime

2012-03-15 Thread Timon Gehr
On 03/15/2012 09:40 AM, Dmitry Olshansky wrote: On 15.03.2012 2:44, Jakob Bornecrantz wrote: Not true, as Steven said a opaque pImpl implementation would work, most modern C library design follow this principle with only using opaque except for pointers. This is because the ABI will then only

Re: Replacing AA's in druntime

2012-03-15 Thread Dmitry Olshansky
On 15.03.2012 12:52, Timon Gehr wrote: On 03/15/2012 09:40 AM, Dmitry Olshansky wrote: On 15.03.2012 2:44, Jakob Bornecrantz wrote: Not true, as Steven said a opaque pImpl implementation would work, most modern C library design follow this principle with only using opaque except for pointers.

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Jacob Carlborg
On 2012-03-15 08:59, foobar wrote: On Wednesday, 14 March 2012 at 23:14:42 UTC, H. S. Teoh wrote: Alright, I've finished the basic functionality of my AA implementation. I still haven't solved that problem with using suffixless string literals to index X[dstring], so you'll have to write

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Steven Schveighoffer
On Thu, 15 Mar 2012 06:19:33 -0400, Jacob Carlborg d...@me.com wrote: On 2012-03-15 08:59, foobar wrote: On Wednesday, 14 March 2012 at 23:14:42 UTC, H. S. Teoh wrote: Alright, I've finished the basic functionality of my AA implementation. I still haven't solved that problem with using

Re: Replacing AA's in druntime

2012-03-15 Thread Steven Schveighoffer
On Thu, 15 Mar 2012 04:52:41 -0400, Timon Gehr timon.g...@gmx.ch wrote: On 03/15/2012 09:40 AM, Dmitry Olshansky wrote: On 15.03.2012 2:44, Jakob Bornecrantz wrote: Not true, as Steven said a opaque pImpl implementation would work, most modern C library design follow this principle with only

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Jacob Carlborg
On 2012-03-15 11:39, Steven Schveighoffer wrote: On Thu, 15 Mar 2012 06:19:33 -0400, Jacob Carlborg d...@me.com wrote: I think object.d should be empty except for the definition of Object. The rest should be located in their own modules and publicly imported in object.d I think the compiler

Re: Replacing AA's in druntime

2012-03-15 Thread Steven Schveighoffer
On Wed, 14 Mar 2012 19:20:43 -0400, Jakob Bornecrantz wallbra...@gmail.com wrote: On Wednesday, 14 March 2012 at 14:02:30 UTC, Steven Schveighoffer wrote: This is unavoidable, whether it's a template or not. What changes do you envision would be transparent using an opaque pImpl model

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Steven Schveighoffer
On Thu, 15 Mar 2012 06:47:00 -0400, Jacob Carlborg d...@me.com wrote: On 2012-03-15 11:39, Steven Schveighoffer wrote: On Thu, 15 Mar 2012 06:19:33 -0400, Jacob Carlborg d...@me.com wrote: I think object.d should be empty except for the definition of Object. The rest should be located in

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Jacob Carlborg
On 2012-03-15 11:52, Steven Schveighoffer wrote: Isn't full name of TypeInfo object.TypeInfo? Is that not hard-coded into the compiler? -Steve I have no idea if object.TypeInfo is hard-coded into the compiler. -- /Jacob Carlborg

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Don Clugston
On 15/03/12 00:16, H. S. Teoh wrote: On Tue, Mar 13, 2012 at 09:30:45PM -0500, Andrei Alexandrescu wrote: On 3/13/12 7:54 PM, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready to replace aaA.d. Great! This will need compiler restructuring, and in fact

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Andrei Alexandrescu
On 3/15/12 11:02 AM, Don Clugston wrote: This is good, and very, very important. Do *not* make any attempt at compiler integration until it is *completely* ready. This includes AA literals. They need to be accepted somehow. The compiler will give you syntax sugar and *nothing* more. One

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Steven Schveighoffer
On Thu, 15 Mar 2012 12:05:46 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 3/15/12 11:02 AM, Don Clugston wrote: This is good, and very, very important. Do *not* make any attempt at compiler integration until it is *completely* ready. This includes AA literals. They

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread H. S. Teoh
On Thu, Mar 15, 2012 at 05:02:06PM +0100, Don Clugston wrote: On 15/03/12 00:16, H. S. Teoh wrote: [...] This is good, and very, very important. Do *not* make any attempt at compiler integration until it is *completely* ready. This includes AA literals. They need to be accepted somehow. The

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Andrei Alexandrescu
On 3/15/12 12:12 PM, Steven Schveighoffer wrote: On Thu, 15 Mar 2012 12:05:46 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 3/15/12 11:02 AM, Don Clugston wrote: This is good, and very, very important. Do *not* make any attempt at compiler integration until it is

Re: Replacing AA's in druntime

2012-03-15 Thread Timon Gehr
On 03/15/2012 11:41 AM, Steven Schveighoffer wrote: Second, that breaks a *LOT* of code which expects AA's to just be declared and used. Not necessarily. The compiler could still do the auto-initialization.

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Steven Schveighoffer
On Thu, 15 Mar 2012 13:24:24 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 3/15/12 12:12 PM, Steven Schveighoffer wrote: On Thu, 15 Mar 2012 12:05:46 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 3/15/12 11:02 AM, Don Clugston wrote: This is good,

Re: Replacing AA's in druntime

2012-03-15 Thread Steven Schveighoffer
On Thu, 15 Mar 2012 13:28:00 -0400, Timon Gehr timon.g...@gmx.ch wrote: On 03/15/2012 11:41 AM, Steven Schveighoffer wrote: Second, that breaks a *LOT* of code which expects AA's to just be declared and used. Not necessarily. The compiler could still do the auto-initialization. Auto

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Steven Schveighoffer
On Thu, 15 Mar 2012 13:39:19 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Thu, 15 Mar 2012 13:24:24 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: What would that look like? auto aa = [1:1]; becomes: int[1] __k = [1]; // obviously, no heap allocation

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Andrei Alexandrescu
On 3/15/12 12:39 PM, Steven Schveighoffer wrote: On Thu, 15 Mar 2012 13:24:24 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Template function takes over, does whatever is necessary, such as possibly conversion to varargs. Right, but with a template: [1:1] [1:1, 2:2] become

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread H. S. Teoh
On Thu, Mar 15, 2012 at 10:22:06AM -0700, H. S. Teoh wrote: [...] This is one major area that I forgot to mention, and that is, making AA literals work at compile-time. Currently things like this don't work: enum myAA = [abc:123, def:456]; I'd like to make that work. That would

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Steven Schveighoffer
On Thu, 15 Mar 2012 14:11:11 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 3/15/12 12:39 PM, Steven Schveighoffer wrote: On Thu, 15 Mar 2012 13:24:24 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: Template function takes over, does whatever is

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Dmitry Olshansky
On 15.03.2012 21:22, H. S. Teoh wrote: On Thu, Mar 15, 2012 at 05:02:06PM +0100, Don Clugston wrote: On 15/03/12 00:16, H. S. Teoh wrote: [...] This is good, and very, very important. Do *not* make any attempt at compiler integration until it is *completely* ready. This includes AA literals.

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread foobar
On Thursday, 15 March 2012 at 10:39:04 UTC, Steven Schveighoffer wrote: On Thu, 15 Mar 2012 06:19:33 -0400, Jacob Carlborg I think object.d should be empty except for the definition of Object. The rest should be located in their own modules and publicly imported in object.d I think the

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread H. S. Teoh
On Thu, Mar 15, 2012 at 11:50:47PM +0400, Dmitry Olshansky wrote: [...] This is one major area that I forgot to mention, and that is, making AA literals work at compile-time. Currently things like this don't work: enum myAA = [abc:123, def:456]; I'd like to make that work. That would

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Andrei Alexandrescu
On 3/15/12 5:59 PM, foobar wrote: It frustrates me to no end Andrei's refusal to accept a design proven to work for half a century (which is already utilized by the compiler!) - the File System. Choosing instead to duplicate organization features inside DDOC as sections. This is a classic

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread Jonathan M Davis
On Thursday, March 15, 2012 21:10:43 Andrei Alexandrescu wrote: On 3/15/12 5:59 PM, foobar wrote: It frustrates me to no end Andrei's refusal to accept a design proven to work for half a century (which is already utilized by the compiler!) - the File System. Choosing instead to duplicate

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-15 Thread H. S. Teoh
On Thu, Mar 15, 2012 at 05:02:06PM +0100, Don Clugston wrote: [...] This is good, and very, very important. Do *not* make any attempt at compiler integration until it is *completely* ready. This includes AA literals. They need to be accepted somehow. The compiler will give you syntax sugar

Re: Replacing AA's in druntime

2012-03-14 Thread Dmitry Olshansky
On 14.03.2012 6:39, Jakob Bornecrantz wrote: On Wednesday, 14 March 2012 at 00:52:32 UTC, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready to replace aaA.d. So far I've been writing the implementation outside of object_.d for ease of testing development;

Re: Replacing AA's in druntime

2012-03-14 Thread Don Clugston
On 14/03/12 03:39, Jakob Bornecrantz wrote: On Wednesday, 14 March 2012 at 00:52:32 UTC, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready to replace aaA.d. So far I've been writing the implementation outside of object_.d for ease of testing development;

Re: Replacing AA's in druntime

2012-03-14 Thread Steven Schveighoffer
On Tue, 13 Mar 2012 22:39:25 -0400, Jakob Bornecrantz wallbra...@gmail.com wrote: On Wednesday, 14 March 2012 at 00:52:32 UTC, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready to replace aaA.d. So far I've been writing the implementation outside of

Re: Replacing AA's in druntime

2012-03-14 Thread Jakob Bornecrantz
On Wednesday, 14 March 2012 at 09:07:40 UTC, Dmitry Olshansky wrote: On 14.03.2012 6:39, Jakob Bornecrantz wrote: On Wednesday, 14 March 2012 at 00:52:32 UTC, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready to replace aaA.d. So far I've been writing

Re: Replacing AA's in druntime

2012-03-14 Thread Jakob Bornecrantz
On Wednesday, 14 March 2012 at 13:55:23 UTC, Don Clugston wrote: On 14/03/12 03:39, Jakob Bornecrantz wrote: On Wednesday, 14 March 2012 at 00:52:32 UTC, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready to replace aaA.d. So far I've been writing the

Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-14 Thread H. S. Teoh
On Tue, Mar 13, 2012 at 09:30:45PM -0500, Andrei Alexandrescu wrote: On 3/13/12 7:54 PM, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready to replace aaA.d. Great! This will need compiler restructuring, and in fact offers the perfect opportunity for

Re: Replacing AA's in druntime

2012-03-14 Thread Jakob Bornecrantz
On Wednesday, 14 March 2012 at 14:02:30 UTC, Steven Schveighoffer wrote: On Tue, 13 Mar 2012 22:39:25 -0400, Jakob Bornecrantz wallbra...@gmail.com wrote: On Wednesday, 14 March 2012 at 00:52:32 UTC, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready to

Re: Replacing AA's in druntime

2012-03-14 Thread H. S. Teoh
On Thu, Mar 15, 2012 at 12:20:43AM +0100, Jakob Bornecrantz wrote: [...] struct AAver1(K, V) { K[] tbl; V[] tlb2; uint size; } struct AAver2(K, V) { K[] tbl; V[] tbl2; V[] optimizationTbl; } Would break if a AAver1 table was ever passed to code that was compiled against a

Re: Replacing AA's in druntime

2012-03-14 Thread Jakob Bornecrantz
On Wednesday, 14 March 2012 at 23:51:30 UTC, H. S. Teoh wrote: On Thu, Mar 15, 2012 at 12:20:43AM +0100, Jakob Bornecrantz wrote: [...] struct AAver1(K, V) { K[] tbl; V[] tlb2; uint size; } struct AAver2(K, V) { K[] tbl; V[] tbl2; V[] optimizationTbl; } Would break if a AAver1 table

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-14 Thread Andrei Alexandrescu
On 3/14/12 6:16 PM, H. S. Teoh wrote: - Declaring an AA with non-const array keys will cause reams and reams of compile errors. I'm not *too* worried about this at the moment since it doesn't make sense to have non-const AA keys anyway. I'm also seriously considering forcing *all* AA

Re: Standalone AA implementation ready for review (Was: Re: Replacing AA's in druntime)

2012-03-14 Thread H. S. Teoh
On Wed, Mar 14, 2012 at 11:58:01PM -0500, Andrei Alexandrescu wrote: On 3/14/12 6:16 PM, H. S. Teoh wrote: - Declaring an AA with non-const array keys will cause reams and reams of compile errors. I'm not *too* worried about this at the moment since it doesn't make sense to have

Replacing AA's in druntime

2012-03-13 Thread H. S. Teoh
Hi all, My AA implementation is slowly inching closer to being ready to replace aaA.d. So far I've been writing the implementation outside of object_.d for ease of testing development; now I'm ready to start moving stuff into object_.d to start working on integration with druntime. So I'm

Re: Replacing AA's in druntime

2012-03-13 Thread Daniel Murphy
Welcome to Hell. =D Some of the things you can do with AAs are recognized by the compiler during semantic and turned into druntime calls, sometimes the constructs survive all the way to the glue layer (e2ir) and are turned into druntime calls there and sometimes the type of an expressions is

Re: Replacing AA's in druntime

2012-03-13 Thread James Miller
On 14 March 2012 14:37, Daniel Murphy yebbl...@nospamgmail.com wrote: Welcome to Hell. =D Sounds fun. (Seasoned DF player) -- James Miller

Re: Replacing AA's in druntime

2012-03-13 Thread Andrei Alexandrescu
On 3/13/12 7:54 PM, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready to replace aaA.d. Great! This will need compiler restructuring, and in fact offers the perfect opportunity for it. I suggest you to post your implementation here for review first, and

Re: Replacing AA's in druntime

2012-03-13 Thread Jakob Bornecrantz
On Wednesday, 14 March 2012 at 00:52:32 UTC, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready to replace aaA.d. So far I've been writing the implementation outside of object_.d for ease of testing development; now I'm ready to start moving stuff into

Re: Replacing AA's in druntime

2012-03-13 Thread H. S. Teoh
On Tue, Mar 13, 2012 at 09:30:45PM -0500, Andrei Alexandrescu wrote: On 3/13/12 7:54 PM, H. S. Teoh wrote: Hi all, My AA implementation is slowly inching closer to being ready to replace aaA.d. Great! This will need compiler restructuring, and in fact offers the perfect opportunity for

Re: Replacing AA's in druntime

2012-03-13 Thread H. S. Teoh
On Wed, Mar 14, 2012 at 12:37:08PM +1100, Daniel Murphy wrote: Welcome to Hell. =D Ahhhahahaha... sounds like I leapt into the deep end of the pool without knowing it. :-P Some of the things you can do with AAs are recognized by the compiler during semantic and turned into druntime calls,

Re: Replacing AA's in druntime

2012-03-13 Thread Daniel Murphy
H. S. Teoh hst...@quickfur.ath.cx wrote in message news:mailman.651.1331696880.4860.digitalmar...@puremagic.com... On Wed, Mar 14, 2012 at 12:37:08PM +1100, Daniel Murphy wrote: Welcome to Hell. =D Ahhhahahaha... sounds like I leapt into the deep end of the pool without knowing it. :-P