Re: isArray and std.container.Array

2014-09-29 Thread via Digitalmars-d-learn
On Sunday, 28 September 2014 at 20:24:11 UTC, monarch_dodra wrote: On Sunday, 28 September 2014 at 19:06:09 UTC, Marc Schütz wrote: On Sunday, 28 September 2014 at 16:12:53 UTC, Meta wrote: On Sunday, 28 September 2014 at 08:01:00 UTC, Nordlöw wrote: Is there a reason why isArray!T doesn't

Re: isArray and std.container.Array

2014-09-29 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 29 September 2014 at 10:18:09 UTC, Marc Schütz wrote: On Sunday, 28 September 2014 at 20:24:11 UTC, monarch_dodra wrote: On Sunday, 28 September 2014 at 19:06:09 UTC, Marc Schütz wrote: On Sunday, 28 September 2014 at 16:12:53 UTC, Meta wrote: On Sunday, 28 September 2014 at

[dub] Building DLLs

2014-09-29 Thread Chris via Digitalmars-d-learn
Today I tried to build a dll via dub, unfortunately I didn't succeed. I couldn't find much on the internet about it. Is it at all possible, and if yes, what's the config I have to use? I tried this (and similar configs) { name: myDLL32bit, targetName: myDLL.dll, targetType:

out parameter with default value

2014-09-29 Thread AsmMan via Digitalmars-d-learn
Why it does works: void f(out int c) { if(some_cond) c = 10; } but it doesn't? void f(out int c = 1) { if(some_cond) c = 10; } it give compiler error: Error: constant 1 is not an lvalue

Re: out parameter with default value

2014-09-29 Thread AsmMan via Digitalmars-d-learn
My question is why it doesn't works and if there's a workaround

Re: out parameter with default value

2014-09-29 Thread via Digitalmars-d-learn
On Monday, 29 September 2014 at 16:09:11 UTC, AsmMan wrote: My question is why it doesn't works and if there's a workaround For the same reason `ref` wouldn't work in this place: It doesn't accept rvalues. A workaround might be to create a global variable that is initialized to the value

vibe.d https_server example fails

2014-09-29 Thread Nordlöw
When build and run (using dub) the examples/https_server/ under vibe.d master it prints Target vibe-d ~master is up to date. Use --force to rebuild. Building https-server-example ~master configuration application, build type debug. Compiling using dmd... Linking... Running

Re: vibe.d https_server example fails

2014-09-29 Thread Martin Nowak via Digitalmars-d-learn
On 09/29/2014 06:31 PM, Nordlöw wrote: What's wrong? Certificates? Use https instead of http :). https://localhost:8080/

Turn function into infinite range

2014-09-29 Thread Martin Nowak via Digitalmars-d-learn
Does anyone know a construct to turn a lambda into an infinite range. import std.random; unittest { Random gen; foreach(v; xxx!(() = uniform(0, 100, gen)).take(10)) writeln(v); } I though I've seen this around somewhere but can no longer find it.

Re: Turn function into infinite range

2014-09-29 Thread Brad Anderson via Digitalmars-d-learn
On Monday, 29 September 2014 at 17:02:43 UTC, Martin Nowak wrote: Does anyone know a construct to turn a lambda into an infinite range. import std.random; unittest { Random gen; foreach(v; xxx!(() = uniform(0, 100, gen)).take(10)) writeln(v); } I

Re: out parameter with default value

2014-09-29 Thread ketmar via Digitalmars-d-learn
On Mon, 29 Sep 2014 16:07:49 + AsmMan via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: but it doesn't? void f(out int c = 1) 'cause `out int c` is actually `int* c`. you can't assign int(1) to pointer. signature.asc Description: PGP signature

Re: vibe.d https_server example fails

2014-09-29 Thread Nordlöw
On Monday, 29 September 2014 at 16:57:52 UTC, Martin Nowak wrote: Use https instead of http :). Doh! https://localhost:8080/ This however crashes the server program as Error executing command run: Program exited with code -11 Maybe I should use a vibe.d version other than master?

Re: vibe.d https_server example fails

2014-09-29 Thread Martin Nowak via Digitalmars-d-learn
On 09/29/2014 08:20 PM, Nordlöw wrote: This however crashes the server program as Error executing command run: Program exited with code -11 Maybe I should use a vibe.d version other than master? Please report it https://github.com/rejectedsoftware/vibe.d/issues, there seems to be some issue

Re: Turn function into infinite range

2014-09-29 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 29 September 2014 at 17:02:43 UTC, Martin Nowak wrote: I though I've seen this around somewhere but can no longer find it. AFAIK, this as never existed. We recently merged in cache into phobos. This seems like a prime candidate to expand to also take a function/delegate, as on of

Re: out parameter with default value

2014-09-29 Thread AsmMan via Digitalmars-d-learn
I had just forget out and ref are same as pointers... thanks guys

find all public properties at compile time

2014-09-29 Thread gedaiu via Digitalmars-d-learn
Hi, There is a way to determine all public properties (not methods) from a struct/class at compile time? I seen that there are traits to get only methods but not properties. Am I wrong? thanks, Bogdan

Re: Turn function into infinite range

2014-09-29 Thread Daniel Kozák via Digitalmars-d-learn
V Mon, 29 Sep 2014 19:02:36 +0200 Martin Nowak via Digitalmars-d-learn digitalmars-d-learn@puremagic.com napsáno: Does anyone know a construct to turn a lambda into an infinite range. import std.random; unittest { Random gen; foreach(v; xxx!(() =

Re: Turn function into infinite range

2014-09-29 Thread monarch_dodra via Digitalmars-d-learn
On Monday, 29 September 2014 at 21:16:27 UTC, Daniel Kozák via Digitalmars-d-learn wrote: V Mon, 29 Sep 2014 19:02:36 +0200 Martin Nowak via Digitalmars-d-learn digitalmars-d-learn@puremagic.com napsáno: Does anyone know a construct to turn a lambda into an infinite range. import

Re: vibe.d https_server example fails

2014-09-29 Thread Nordlöw
On Monday, 29 September 2014 at 18:37:28 UTC, Martin Nowak wrote: Please report it https://github.com/rejectedsoftware/vibe.d/issues, there seems to be some issue with interface/class casting and manual class allocation. This time I got: Handling of connection failed: Failed to accept SSL

Re: vibe.d https_server example fails

2014-09-29 Thread Etienne via Digitalmars-d-learn
Yes, the ssl_stream should be defined outside the if clause. The FreeLostRef refcount goes to 0 when it goes out of scope in http/server.d On Monday, 29 September 2014 at 21:39:03 UTC, Nordlöw wrote: On Monday, 29 September 2014 at 18:37:28 UTC, Martin Nowak wrote: Please report it

Re: Localizing a D application - best practices?

2014-09-29 Thread Chris via Digitalmars-d-learn
On Sunday, 28 September 2014 at 21:29:21 UTC, Cliff wrote: Coming from the C# world, all of localization we did was based on defining string resource files (XML-formatted source files which were translated into C# classes with named-string accessors by the build process) that would get

Re: vibe.d https_server example fails

2014-09-29 Thread Martin Nowak via Digitalmars-d-learn
On 09/29/2014 11:41 PM, Etienne wrote: Yes, the ssl_stream should be defined outside the if clause. The FreeLostRef refcount goes to 0 when it goes out of scope in http/server.d Well, how about a pull then? https://github.com/rejectedsoftware/vibe.d/issues/846

Re: Localizing a D application - best practices?

2014-09-29 Thread Freddy via Digitalmars-d-learn
On Sunday, 28 September 2014 at 21:29:21 UTC, Cliff wrote: Coming from the C# world, all of localization we did was based on defining string resource files (XML-formatted source files which were translated into C# classes with named-string accessors by the build process) that would get

Re: is there any reason UFCS can't be used with 'new'?

2014-09-29 Thread Jay via Digitalmars-d-learn
On Sunday, 28 September 2014 at 22:17:03 UTC, Meta wrote: I'm not sure. Maybe it's on the same level as the Lambda Abstraction (14.5), but you'll probably have to do some testing to figure it out exactly. precedence levels seem to be defined in `src/parse.h` (the `PREC` enum) and assigned to

Re: out parameter with default value

2014-09-29 Thread ketmar via Digitalmars-d-learn
On Mon, 29 Sep 2014 20:22:41 + AsmMan via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I had just forget out and ref are same as pointers... thanks guys yeah, that syntactic sugar can be confusing sometimes. ;-) signature.asc Description: PGP signature

Interfacing with webcam

2014-09-29 Thread Kyle via Digitalmars-d-learn
Hi, Has anyone successfully used D to capture images from a webcam? Something like what you can do with OpenCV or pygame's camera API? Any idea how I can do this without having to know a lot of complex stuff? Thanks!