Re: variable x cannot be read at compile time (ctfe)

2012-12-18 Thread maarten van damme
My only assumption is that -version=runtime doesn't utilize ctfe and the other does. The rest is simple timing on both linux and windows and ctfe is way slower... 2012/12/18 bearophile : > maarten van damme: > >> How can this be? > > > Maybe there are some mistakes in your assumptions. > > Bye, >

Re: variable x cannot be read at compile time (ctfe)

2012-12-18 Thread bearophile
maarten van damme: How can this be? Maybe there are some mistakes in your assumptions. Bye, bearophilwe

Re: variable x cannot be read at compile time (ctfe)

2012-12-17 Thread js.mdnq
On Monday, 17 December 2012 at 22:47:33 UTC, bearophile wrote: maarten van damme: How do I make dmd output asm? You can't, unfortunately. They closed this enhancement request of mine because they say DMD is not designed for this. On Linux there are several disassemblers, I use objdump. On

Re: variable x cannot be read at compile time (ctfe)

2012-12-17 Thread Ali Çehreli
On 12/17/2012 02:47 PM, bearophile wrote: maarten van damme: How do I make dmd output asm? You can't, unfortunately. They closed this enhancement request of mine because they say DMD is not designed for this. On Linux there are several disassemblers, I use objdump. On Windows there are other

Re: variable x cannot be read at compile time (ctfe)

2012-12-17 Thread bearophile
maarten van damme: How do I make dmd output asm? You can't, unfortunately. They closed this enhancement request of mine because they say DMD is not designed for this. On Linux there are several disassemblers, I use objdump. On Windows there are other ones. Bye, bearophile

Re: variable x cannot be read at compile time (ctfe)

2012-12-17 Thread maarten van damme
How do I make dmd output asm? I wrote a simple test and for a simple int[] array it was 2,5 times slower. 2012/12/17 bearophile : > maarten van damme: > > >> it's odd that the resulting arraylist is slower to access at runtime >> then the arraylist generated at runtime... Is there a reason for th

Re: variable x cannot be read at compile time (ctfe)

2012-12-17 Thread bearophile
maarten van damme: it's odd that the resulting arraylist is slower to access at runtime then the arraylist generated at runtime... Is there a reason for this? In such cases, beside thinking some time about the topic, one solution is to take a look at the asm. Maybe it's the same problem as

Re: variable x cannot be read at compile time (ctfe)

2012-12-17 Thread maarten van damme
Thanks, I'm really happy it works now. it's odd that the resulting arraylist is slower to access at runtime then the arraylist generated at runtime... Is there a reason for this? Should I open bugreports for your testcases? 2012/12/17 bearophile : >> I think it's a problem of nested delegates at

Re: variable x cannot be read at compile time (ctfe)

2012-12-17 Thread bearophile
I think it's a problem of nested delegates at CT. But if this is the problem, dmd used to give a more clear error message. Two minimized programs that show the problems: - import std.algorithm: filter; import std.array: array; auto foo(in int x) { return [1, 2].filter!(i => x)(

Re: variable x cannot be read at compile time (ctfe)

2012-12-17 Thread bearophile
maarten van damme: Here is a trimmed down version : http://dpaste.dzfl.pl/11170641 thanks for the quick reply. It seems to work if you move ".array()" from generateBitsetCache() to bitsetToRange(). I think it's a problem of nested delegates at CT. But if this is the problem, dmd used to gi

Re: variable x cannot be read at compile time (ctfe)

2012-12-17 Thread bearophile
maarten van damme: I always get "variable x cannot be read at compile time" in this method : auto bitsetToRange(in SudokuCell x) { return boardSide.iota().filter!(i => (x >> i) & 1)().map!(x=>x+1)(); } with SudokuCell beeing declared as: alias ushort SudokuCell; Why don't you show us

Re: variable x cannot be read at compile time (ctfe)

2012-12-17 Thread monarch_dodra
On Monday, 17 December 2012 at 09:42:50 UTC, maarten van damme wrote: I finally got around trying to finish my sudoksolver and I'm pretty happy with the result, except one little piece that screams for ctfe but I never seem to get it working. I always get "variable x cannot be read at compile t

variable x cannot be read at compile time (ctfe)

2012-12-17 Thread maarten van damme
I finally got around trying to finish my sudoksolver and I'm pretty happy with the result, except one little piece that screams for ctfe but I never seem to get it working. I always get "variable x cannot be read at compile time" in this method : auto bitsetToRange(in SudokuCell x) { return bo