Re: enum to string

2009-03-10 Thread Jarrett Billingsley
On Tue, Mar 10, 2009 at 9:54 PM, Nick Sabalausky wrote: > "MIURA Masahiro" wrote in message > news:gp730i$30e...@digitalmars.com... >> In D2: >> >> enum Shape: string >> { >>    Square = "Square", >>    Circle = "Circle", >> } >> >> void main() >> { >>    assert(cast(string) Shape.Square == "Squa

Re: enum to string

2009-03-10 Thread Nick Sabalausky
"MIURA Masahiro" wrote in message news:gp730i$30e...@digitalmars.com... > In D2: > > enum Shape: string > { >Square = "Square", >Circle = "Circle", > } > > void main() > { >assert(cast(string) Shape.Square == "Square"); > } So there's no built-in way to do this with compile-time refl

Re: enum to string

2009-03-10 Thread Daniel Keep
Nick Sabalausky wrote: > Is there any way to do this (preferably in D1) with reflection? (ie, without > having to manually create a conversion func/lookup for every value of every > enum.) > > -- > enum Shape > { > Square, Circle > } > char[] foo(Shape s) > { > // ?

Re: enum to string

2009-03-10 Thread MIURA Masahiro
In D2: enum Shape: string { Square = "Square", Circle = "Circle", } void main() { assert(cast(string) Shape.Square == "Square"); }

enum to string

2009-03-10 Thread Nick Sabalausky
Is there any way to do this (preferably in D1) with reflection? (ie, without having to manually create a conversion func/lookup for every value of every enum.) -- enum Shape { Square, Circle } char[] foo(Shape s) { // ? } // Either one of these, I don't really ca

Re: Dear toolchain...

2009-03-10 Thread torhu
On 10.03.2009 19:38, Simen Haugen wrote: Jarrett Billingsley wrote: On Tue, Mar 10, 2009 at 1:45 PM, Simen Haugen wrote: I'm waist deep in problems, and have no idea how to get up. I have a program that uses d1, dmd, tango, ddbi, dwt and dwin. Some time ago I discovered that the program w

Re: Moving from 1.0 to D2

2009-03-10 Thread Trass3r
jicman schrieb: Can the D1 code be easily changed to D2? We are talking about more than 30K lines of code. The most important change is constness. I personally use the following compatibility "layer"; though it's aim is to provide compatibility with both D1 and D2 compilers and not complet

Re: Dear toolchain...

2009-03-10 Thread Simen Haugen
Bill Baxter wrote: On Tue, Mar 10, 2009 at 10:45 AM, Simen Haugen wrote: I'm waist deep in problems, and have no idea how to get up. I have a program that uses d1, dmd, tango, ddbi, dwt and dwin. Some time ago I discovered that the program would no longer compile, and I have several features a

Re: Dear toolchain...

2009-03-10 Thread Simen Haugen
Bill Baxter wrote: On Tue, Mar 10, 2009 at 10:45 AM, Simen Haugen wrote: I'm waist deep in problems, and have no idea how to get up. I have a program that uses d1, dmd, tango, ddbi, dwt and dwin. Some time ago I discovered that the program would no longer compile, and I have several features a

Re: Dear toolchain...

2009-03-10 Thread Bill Baxter
On Tue, Mar 10, 2009 at 10:45 AM, Simen Haugen wrote: > I'm waist deep in problems, and have no idea how to get up. > > I have a program that uses d1, dmd, tango, ddbi, dwt and dwin. Some time ago > I discovered that the program would no longer compile, and I have several > features and bugfixes l

Re: Dear toolchain...

2009-03-10 Thread Simen Haugen
Jarrett Billingsley wrote: On Tue, Mar 10, 2009 at 1:45 PM, Simen Haugen wrote: I'm waist deep in problems, and have no idea how to get up. I have a program that uses d1, dmd, tango, ddbi, dwt and dwin. Some time ago I discovered that the program would no longer compile, and I have several fea

Re: Dear toolchain...

2009-03-10 Thread Jarrett Billingsley
On Tue, Mar 10, 2009 at 1:45 PM, Simen Haugen wrote: > I'm waist deep in problems, and have no idea how to get up. > > I have a program that uses d1, dmd, tango, ddbi, dwt and dwin. Some time ago > I discovered that the program would no longer compile, and I have several > features and bugfixes lo

Dear toolchain...

2009-03-10 Thread Simen Haugen
I'm waist deep in problems, and have no idea how to get up. I have a program that uses d1, dmd, tango, ddbi, dwt and dwin. Some time ago I discovered that the program would no longer compile, and I have several features and bugfixes long overdue. It seems the problem happens during linking, b

Re: Reuse of variables referencing const objects

2009-03-10 Thread Steven Schveighoffer
On Mon, 09 Mar 2009 23:00:50 -0400, Chris Nicholson-Sauls wrote: Sergey Kovrov wrote: On 3/9/2009 8:50 PM, Chris Nicholson-Sauls wrote: While not strictly intuitive, you could do this: auto var = Rebindable!(const Foo)(new Foo); assert(var.opDot !is null); As 'opDot' returns the wrapped objec

Re: Moving from 1.0 to D2

2009-03-10 Thread Steven Schveighoffer
On Tue, 10 Mar 2009 11:15:36 -0400, Sean Kelly wrote: Steven Schveighoffer wrote: On Mon, 09 Mar 2009 17:55:48 -0400, jicman wrote: How much different is D2 vs. D1? Much. Much much much ;) It's almost another language. But most of the differences aren't breaking changes. You'll enco

Re: Moving from 1.0 to D2

2009-03-10 Thread Sean Kelly
Steven Schveighoffer wrote: On Mon, 09 Mar 2009 17:55:48 -0400, jicman wrote: How much different is D2 vs. D1? Much. Much much much ;) It's almost another language. But most of the differences aren't breaking changes. You'll encounter some problems with string literals because of the ne