Re: Phobos Members-Tuple function?

2013-01-19 Thread Timon Gehr
On 01/20/2013 06:59 AM, Timon Gehr wrote: The somewhat related fact that static foreach over a sequence of enum values does not work is a compiler bug. I guess this is your problem. (The original post was confusing because it contained pseudo code.) To prevent confusion in the future, please

Re: Phobos Members-Tuple function?

2013-01-19 Thread Timon Gehr
On 01/20/2013 04:55 AM, F i L wrote: Ali Çehreli wrote: The following program produces this output: [...code...] Awesome! Thanks, I wasn't expecting it to actually be as easy as that. I tried all sort of difference combinations with __traits(allMembers, ..) but it looks like I just needed to

Re: Phobos Members-Tuple function?

2013-01-19 Thread F i L
Ali Çehreli wrote: The following program produces this output: [...code...] Awesome! Thanks, I wasn't expecting it to actually be as easy as that. I tried all sort of difference combinations with __traits(allMembers, ..) but it looks like I just needed to move it into the foreach loop itsel

Re: Phobos Members-Tuple function?

2013-01-19 Thread Timon Gehr
On 01/20/2013 03:41 AM, Ali Çehreli wrote: ... void main() { auto ship = new Ship; alias T = typeof(ship); foreach (m; __traits(allMembers, T)) { writefln("member %s", m); enum atrs = __traits(getAttributes, mixin(T.stringof ~ "." ~ m)); This only works b

Re: Phobos Members-Tuple function?

2013-01-19 Thread Timon Gehr
On 01/20/2013 03:59 AM, Ali Çehreli wrote: On 01/19/2013 06:41 PM, Ali Çehreli wrote: > class Engine > { > static bindActors(Actor, string pattern) > { > writefln(" Binding actor with pattern %s", pattern); > } > } How come that function compiles without a return type? Th

Re: Phobos Members-Tuple function?

2013-01-19 Thread Ali Çehreli
On 01/19/2013 06:41 PM, Ali Çehreli wrote: > class Engine > { > static bindActors(Actor, string pattern) > { > writefln(" Binding actor with pattern %s", pattern); > } > } How come that function compiles without a return type? The following is a bug, right? class C { static foo() // <--

Re: Phobos Members-Tuple function?

2013-01-19 Thread Ali Çehreli
On 01/19/2013 12:10 PM, F i L wrote: > Is there a function in phobos which will return a Tuple of a Type's > members, for use in a foreach statement? The following program produces this output: member update attribute Bind("Stage.update") Binding actor with pattern Stage.update member draw

Re: Assembly - 64-bit registers supported?

2013-01-19 Thread Era Scarecrow
On Saturday, 19 January 2013 at 12:45:06 UTC, deed wrote: void main() { asm { movRAX, 3; } } results in: Error: undefined identifier 'RAX' AX and EAX work. Anything missing or isn't it yet implemented? Hmm. I know there's a one byte 'escape code' that for x86 allows

Re: Phobos Members-Tuple function?

2013-01-19 Thread F i L
bearophile wrote: I have not fully understood the problem, but have you tried [__traits(getAttributes, m)] ? yes, that's not really relevant to my problem. 'm' in your example, can't be read at compile time, because __traits(derivedMembers, ..) returns a Tuple of strings, not Symbols. I can

Re: Phobos Members-Tuple function?

2013-01-19 Thread bearophile
F i L: I need this for collecting info on all Type Members's User Attributes. Currently, I have written a recursive function which does this, but I'm looking for a more elegant solution. I have not fully understood the problem, but have you tried [__traits(getAttributes, m)] ? Bye, bearoph

BitArray new design - Hashing out general thoughts and ideas (with slices too)

2013-01-19 Thread Era Scarecrow
On Saturday, 19 January 2013 at 09:07:03 UTC, Dmitry Olshansky wrote: opBinaryAssign --> opOpAssign. opSlice/opSlice assign. In any case it seems to me that (I think you already did this trick before) you can reuse a lot of code by making an operator string a template parameter (for functions t

Phobos Members-Tuple function?

2013-01-19 Thread F i L
Is there a function in phobos which will return a Tuple of a Type's members, for use in a foreach statement? I need this for collecting info on all Type Members's User Attributes. Currently, I have written a recursive function which does this, but I'm looking for a more elegant solution. Let

Re: Pull 1019

2013-01-19 Thread Namespace
Does anyone else think, that merging this pull: https://github.com/D-Programming-Language/dmd/pull/1428 would be better then waiting for pull 1019? Pull 1428 is ready to merge and use. If someday pull 1019 is ready, it can replace pull 1428. Fact is, that this problem has caused big issues by usin

Re: Assembly - 64-bit registers supported?

2013-01-19 Thread nazriel
On Saturday, 19 January 2013 at 13:12:47 UTC, deed wrote: Missing -m64 or something? Probably. I am on Windows using dmd 2.061 and optlink 8.00.12 dmd main.d -m64 Con't run 'bin\amd64\link.exe', check PATH Setting LINKCMD64 to the same path as for LINKCMD in sc.ini: dmd main.d -m64 OPTLINK :

Re: Assembly - 64-bit registers supported?

2013-01-19 Thread deed
Missing -m64 or something? Probably. I am on Windows using dmd 2.061 and optlink 8.00.12 dmd main.d -m64 Con't run 'bin\amd64\link.exe', check PATH Setting LINKCMD64 to the same path as for LINKCMD in sc.ini: dmd main.d -m64 OPTLINK : Warning 9: Unknown Option : MERGE OPTLINK : Error 8: Illeg

Re: Assembly - 64-bit registers supported?

2013-01-19 Thread nazriel
On Saturday, 19 January 2013 at 12:45:06 UTC, deed wrote: void main() { asm { movRAX, 3; } } results in: Error: undefined identifier 'RAX' AX and EAX work. Anything missing or isn't it yet implemented? http://dpaste.dzfl.pl/0f79b5ba Missing -m64 or something?

Assembly - 64-bit registers supported?

2013-01-19 Thread deed
void main() { asm { movRAX, 3; } } results in: Error: undefined identifier 'RAX' AX and EAX work. Anything missing or isn't it yet implemented?

Re: Pull 1019

2013-01-19 Thread Namespace
On Friday, 18 January 2013 at 20:56:43 UTC, Namespace wrote: Not sure what you mean? Nobody will tell you when your pull fails the unittests. When your pull actually gets merged for real into the "head", you aren't notified either (sadly), but the puller usually leaves a "merged" comment, and

Re: BitArray new design - slice problems

2013-01-19 Thread Dmitry Olshansky
19-Jan-2013 11:14, Era Scarecrow пишет: On Friday, 18 January 2013 at 16:42:04 UTC, Dmitry Olshansky wrote: Slices should have a pointer and length so they can check range (in debug builds), alternatively just a pointer to storage that nows the range. So write an alternate opIndex... I thi

Re: Opening a web

2013-01-19 Thread SaltySugar
On Saturday, 19 January 2013 at 08:09:01 UTC, Mirko Pilger wrote: How to open a website in D with your default browser? import std.process; int main(string[] args) { browse("http://dlang.org";); return 0; } Thank you, man!

Re: Opening a web

2013-01-19 Thread Mirko Pilger
How to open a website in D with your default browser? import std.process; int main(string[] args) { browse("http://dlang.org";); return 0; }