Re: win32 capCreateCaptureWindow problem

2009-08-12 Thread Sam Hu
John C Wrote: > Ivan Boritsky wrote: > > i work on a win32 application. i try to access my web camera. > > when i use this api funtion; > > capCreateCaptureWindow("cam", WS_VISIBLE + WS_CHILD, 10, 10,266, 252, hWnd, > > 0); > > That should be: WS_VISIBLE | WS_CHILD. > > > > > i get this error:

Re: Semi Automated Object wrapping

2009-08-12 Thread Bill Baxter
On Wed, Aug 12, 2009 at 4:52 PM, Rory McGuire wrote: > Here is some code I wrote which enables wrapping a proxy around an object. > I am using it for my serialization library. It works in D1(1.046) and D2 > (2.031) > > Posting it here for reference by all before I add to much of the stuff > specifi

Semi Automated Object wrapping

2009-08-12 Thread Rory McGuire
Here is some code I wrote which enables wrapping a proxy around an object. I am using it for my serialization library. It works in D1(1.046) and D2 (2.031) Posting it here for reference by all before I add to much of the stuff specific to my use, should make it easier to follow. usage: new Proxy

Re: setIntersection of struct range

2009-08-12 Thread Sergey Gromov
Tue, 11 Aug 2009 19:35:40 -0400, Jesse Phillips wrote: > I am trying to obtain a rang that is the intersection of two other ranges. To > do this I am using the _setIntersection()_ function. > > import std.algorithm; > import std.stdio; > > struct S { > string label; > } >

Re: setIntersection of struct range

2009-08-12 Thread Jesse Phillips
Jesse Phillips Wrote: > Steven Schveighoffer Wrote: > > > You did not define a way to compare two S structs. Try redefining S like > > this: > > > > struct S { > >string label; > >int opCmp(ref const S s2) const { > > if(label < s2.label) > > return -1; > > if(labe

Re: win32 capCreateCaptureWindow problem

2009-08-12 Thread Ivan Boritsky
thank u very much. it works fine.

Re: 'static' keyword for positional array initialization

2009-08-12 Thread Don
Ali Cehreli wrote: Don Wrote: void main() { int[2] static_0 = [ 1, 1 ]; int[2] static_1 = [ 1:1 ]; } dmd: init.c:431: virtual Expression* ArrayInitializer::toExpression(): Assertion `j < edim' failed. I've added this to Bugzilla as bug 3246. With a patch . Thank you for the quick f

Re: ignored phobos request

2009-08-12 Thread Saaa
filed http://d.puremagic.com/issues/show_bug.cgi?id=3248

Re: "waking up" a thread

2009-08-12 Thread Steven Schveighoffer
On Wed, 12 Aug 2009 13:00:22 -0400, funog wrote: Is there a way to make the current thread sleep for a given amount of time, while having the possibility of another thread "waking it up" earlier? Create a mutex/condition pair, then have one thread wait on the condition with a timeout.

Re: Is [ 0, 1, 2 ] an immutable array?

2009-08-12 Thread Steven Schveighoffer
On Wed, 12 Aug 2009 12:41:20 -0400, Ali Cehreli wrote: Steven Schveighoffer Wrote: > int[] a = [ 0, 1, 2 ]; > a[0] = 42; No, it's a mutable array. It's one of the quirks of D2 that bugs me. A string literal is an immutable array but a normal array literal actually allocates new s

"waking up" a thread

2009-08-12 Thread funog
Is there a way to make the current thread sleep for a given amount of time, while having the possibility of another thread "waking it up" earlier?

Re: Is [ 0, 1, 2 ] an immutable array?

2009-08-12 Thread Ali Cehreli
Steven Schveighoffer Wrote: > > int[] a = [ 0, 1, 2 ]; > > a[0] = 42; > No, it's a mutable array. It's one of the quirks of D2 that bugs me. A > string literal is an immutable array but a normal array literal actually > allocates new space on the heap for the array every time you us

Re: ignored phobos request

2009-08-12 Thread BCS
Reply to Saaa, "Lars T. Kyllingstad" wrote in message news:h5tsuu$bc...@digitalmars.com... http://d.puremagic.com/issues/ I always thought bugzilla was only for bugs.. IIRC when it was set up there was a bit of debate about that and items in it got changed from "bugs" to "issues" to den

Re: setIntersection of struct range

2009-08-12 Thread Jesse Phillips
Steven Schveighoffer Wrote: > You did not define a way to compare two S structs. Try redefining S like > this: > > struct S { >string label; >int opCmp(ref const S s2) const { > if(label < s2.label) > return -1; > if(label > s2.label) > return 1; > ret

Re: 'static' keyword for positional array initialization

2009-08-12 Thread Ali Cehreli
Don Wrote: > > void main() > > { > > int[2] static_0 = [ 1, 1 ]; > > int[2] static_1 = [ 1:1 ]; > > } > > > > dmd: init.c:431: virtual Expression* ArrayInitializer::toExpression(): > > Assertion `j < edim' failed. > > I've added this to Bugzilla as bug 3246. With a patch . Thank you fo

Re: setIntersection of struct range

2009-08-12 Thread Steven Schveighoffer
On Wed, 12 Aug 2009 11:25:10 -0400, Steven Schveighoffer wrote: I think it's expecting dynamc arrays, not static ones. Auto is making them static. BTW, this probably should not be true, I would guess that static arrays should be intersectable, of course the return type would have to b

Re: setIntersection of struct range

2009-08-12 Thread Steven Schveighoffer
On Tue, 11 Aug 2009 19:35:40 -0400, Jesse Phillips wrote: I am trying to obtain a rang that is the intersection of two other ranges. To do this I am using the _setIntersection()_ function. import std.algorithm; import std.stdio; struct S { string label; } void

Re: Is [ 0, 1, 2 ] an immutable array?

2009-08-12 Thread Steven Schveighoffer
On Tue, 11 Aug 2009 19:05:56 -0400, Ali Cehreli wrote: Does the expression [ 0, 1, 2 ] form an immutable array? If so, is the assignment to a[0] undefined below? Is it trying to modify an immutable element? int[] a = [ 0, 1, 2 ]; a[0] = 42; The reason for my thinking that [ 0, 1,

Re: ignored phobos request

2009-08-12 Thread Lars T. Kyllingstad
Saaa wrote: "Lars T. Kyllingstad" wrote in message news:h5tsuu$bc...@digitalmars.com... Saaa wrote: Some time ago I requested something on .D, but it was ignored. I'm interested in why this is so. It was only a small request, maybe not fitting for .D but dsourse/phobos said that was the place

Re: ignored phobos request

2009-08-12 Thread Saaa
"Lars T. Kyllingstad" wrote in message news:h5tsuu$bc...@digitalmars.com... > Saaa wrote: >> Some time ago I requested something on .D, but it was ignored. >> I'm interested in why this is so. >> It was only a small request, maybe not fitting for .D but dsourse/phobos >> said that was the place

Re: 'static' keyword for positional array initialization

2009-08-12 Thread Don
Ali Cehreli wrote: Lars T. Kyllingstad Wrote: I've tried with DMD 2.031, and I can't reproduce this. This works fine for me: int[2] static_0 = [ 1, 1 ]: int[2] static_1 = [ 1:1 ]; Where did you put the declarations? I've tried putting them at both module level and in a class, and both

Re: 'static' keyword for positional array initialization

2009-08-12 Thread grauzone
Ali Cehreli wrote: Lars T. Kyllingstad Wrote: I've tried with DMD 2.031, and I can't reproduce this. This works fine for me: int[2] static_0 = [ 1, 1 ]: int[2] static_1 = [ 1:1 ]; Where did you put the declarations? I've tried putting them at both module level and in a class, and both

Re: 'static' keyword for positional array initialization

2009-08-12 Thread Lars T. Kyllingstad
Ali Cehreli wrote: Lars T. Kyllingstad Wrote: I've tried with DMD 2.031, and I can't reproduce this. This works fine for me: int[2] static_0 = [ 1, 1 ]: int[2] static_1 = [ 1:1 ]; Where did you put the declarations? I've tried putting them at both module level and in a class, and both

Re: 'static' keyword for positional array initialization

2009-08-12 Thread Ali Cehreli
Lars T. Kyllingstad Wrote: > I've tried with DMD 2.031, and I can't reproduce this. This works fine > for me: > >int[2] static_0 = [ 1, 1 ]: >int[2] static_1 = [ 1:1 ]; > > Where did you put the declarations? I've tried putting them at both > module level and in a class, and both times

Re: win32 capCreateCaptureWindow problem

2009-08-12 Thread John C
Ivan Boritsky wrote: i work on a win32 application. i try to access my web camera. when i use this api funtion; capCreateCaptureWindow("cam", WS_VISIBLE + WS_CHILD, 10, 10,266, 252, hWnd, 0); That should be: WS_VISIBLE | WS_CHILD. i get this error: Error: undefined identifier capCreateCaptur

Re: overloading

2009-08-12 Thread Lars T. Kyllingstad
Ellery Newcomer wrote: Why is function overloading not applied to nested functions? Good question. Intuitively it seems to me that they should act just like other functions. I couldn't find anything about it in the spec, but I found this (on the "Functions" page): Unlike module level d

Re: ignored phobos request

2009-08-12 Thread Lars T. Kyllingstad
Saaa wrote: Some time ago I requested something on .D, but it was ignored. I'm interested in why this is so. It was only a small request, maybe not fitting for .D but dsourse/phobos said that was the place for such things. (Maybe it was unintelligible again?) The place (.D) was right, but I t

Re: Is [ 0, 1, 2 ] an immutable array?

2009-08-12 Thread Lars T. Kyllingstad
Ali Cehreli wrote: Does the expression [ 0, 1, 2 ] form an immutable array? If so, is the assignment to a[0] undefined below? Is it trying to modify an immutable element? int[] a = [ 0, 1, 2 ]; a[0] = 42; The reason for my thinking that [ 0, 1, 2] is an array is because it has the .du

Re: 'static' keyword for positional array initialization

2009-08-12 Thread Lars T. Kyllingstad
Ali Cehreli wrote: The 'static' keyword is required by dmd 2.031 for the second of these two definitions: int[2] static_0 = [ 1, 1 ]; static int[2] static_1 = [ 1:1 ]; Is this inconsistency by design? Should 'static' be required for both or neither? Ali I've tried with DMD 2.031, and