Re: ElementType!string

2013-08-26 Thread monarch_dodra
On Sunday, 25 August 2013 at 19:51:50 UTC, qznc wrote: Thanks, somewhat unintuitive. Yes, but un-intuitive... to the un-initiated. By default, it's also safer. A string *is* conceptually, a sequence of unicode codepoints. The fact that it is made of UTF-8 codepoints is really just low level

Limited Semi-PolyMorphic (LSP) structs?

2013-08-26 Thread Era Scarecrow
Been a while and out of the loop, I need to get my hands dirty in the code again (soon). Anyways, let's get to the matter at hand as I'm thinking about it. I'm working on some code (or will work on code again) that could use a polymorphic type, but at the end it will never be shared

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-26 Thread qznc
On Monday, 26 August 2013 at 11:20:17 UTC, Era Scarecrow wrote: Been a while and out of the loop, I need to get my hands dirty in the code again (soon). Anyways, let's get to the matter at hand as I'm thinking about it. I'm working on some code (or will work on code again) that could use a

Re: Limited Semi-PolyMorphic (LSP) structs?

2013-08-26 Thread Era Scarecrow
On Monday, 26 August 2013 at 12:42:43 UTC, qznc wrote: Hm, my try would be alias this for inheritance and function pointers for virtual methods. struct iA { void function(iA) A; void C(); } struct iB { iA _a; alias this = _a; void B(); } If you have multiple subclasses for iA, you

RePost: Help to convert a code to D

2013-08-26 Thread Alexandre
Hi :) I'm starting with D language... and, I try to convert a C# code to D... So, my C# code, I get file informations, and, I create folders with all days of month of specific year... So, that is my C# code... using System; using System.IO; using System.Linq; using System.Collections.Generic;

Re: RePost: Help to convert a code to D

2013-08-26 Thread bearophile
Alexandre: So, that is my C# code... If you don't receive answers, then I suggest you to cut your program in perpendicular slices, and try to translate them in D, one after the other, and to show them here, hoping for comments. In a technical forum people are usually happier when you do

improve concurrent queue

2013-08-26 Thread luminousone
I have been working on a project and needed a good concurrent queue, so I wrote one, is their anyone more familiar with the atomic arts that could tell me if their is anyway i can further improve it. module container.concurrentqueue; import std.typetuple; import core.atomic; class

Re: RePost: Help to convert a code to D

2013-08-26 Thread Andre Artus
On Monday, 26 August 2013 at 13:30:38 UTC, Alexandre wrote: Hi :) I'm starting with D language... and, I try to convert a C# code to D... So, my C# code, I get file informations, and, I create folders with all days of month of specific year... So, that is my C# code... using System; using

Re: RePost: Help to convert a code to D

2013-08-26 Thread Era Scarecrow
I wonder if any of this would make any more sense if you threw it through Google translate.. (maybe the comments and months?) On Monday, 26 August 2013 at 20:14:34 UTC, Andre Artus wrote: Hi Alexandre, Would you mind explaining in English what it is that you would like to achieve. I

Using C/C++-DLL in D

2013-08-26 Thread S0urc3C0de
Hello guys, I'm trying to use a C++-DLL in D. I compiled it via GCC, created a .lib-File with implib, but dmd keeps telling me that the symbol was undefined. For test purposes, I created a Test-DLL with just one simple function that should output a simple text to the console. #define

Re: Using C/C++-DLL in D

2013-08-26 Thread Adam D. Ruppe
When you run implib, did you use the /s option? implib /s either adds or removes the leading underscore from the name (I don't remember which)... so if you didn't use it, try adding that and see what happens, and if you did, see what happens if you remove that option.

Re: Using C/C++-DLL in D

2013-08-26 Thread S0urc3C0de
On Monday, 26 August 2013 at 22:17:07 UTC, Adam D. Ruppe wrote: When you run implib, did you use the /s option? implib /s either adds or removes the leading underscore from the name (I don't remember which)... so if you didn't use it, try adding that and see what happens, and if you did, see

bug or feature? shared objects and tuples

2013-08-26 Thread Jack Applegame
It is impossible to pack a structure with shared object into tuple. ``` import std.concurrency; import std.typecons; class Foo {} struct A { shared Foo foo; } void main() { auto a = tuple(new shared Foo); // ОК auto b = tuple(A());// Error: static assert unable

Re: bug or feature? shared objects and tuples

2013-08-26 Thread Andrej Mitrovic
On 8/27/13, Jack Applegame jappleg...@gmail.com wrote: It is impossible to pack a structure with shared object into tuple. Bug. Please file it to bugzilla: http://d.puremagic.com/issues/enter_bug.cgi?product=D Thanks!

Re: bug or feature? shared objects and tuples

2013-08-26 Thread Jack Applegame
On Monday, 26 August 2013 at 23:04:24 UTC, Andrej Mitrovic wrote: Bug. Please file it to bugzilla: http://d.puremagic.com/issues/enter_bug.cgi?product=D Thanks! http://d.puremagic.com/issues/show_bug.cgi?id=10907

Re: RePost: Help to convert a code to D

2013-08-26 Thread Andre Artus
On Monday, 26 August 2013 at 13:30:38 UTC, Alexandre wrote: Hi :) I'm starting with D language... and, I try to convert a C# code to D... So, my C# code, I get file informations, and, I create folders with all days of month of specific year... So, that is my C# code... -- SNIP -- So, to

Re: Using C/C++-DLL in D

2013-08-26 Thread Andrej Mitrovic
On 8/27/13, S0urc3C0de s0urc3c0de@d.learn wrote: Hello guys, I'm trying to use a C++-DLL in D. I compiled it via GCC, created a .lib-File with implib I don't think you'll be able to match the name mangling, GCC might use one convention, DMD another. There was a pragma(mangle) feature

Re: RePost: Help to convert a code to D

2013-08-26 Thread Andre Artus
On Monday, 26 August 2013 at 21:43:20 UTC, Era Scarecrow wrote: I wonder if any of this would make any more sense if you threw it through Google translate.. (maybe the comments and months?) I did just that :) On Monday, 26 August 2013 at 20:14:34 UTC, Andre Artus wrote: Hi Alexandre,

Re: RePost: Help to convert a code to D

2013-08-26 Thread Andre Artus
On Monday, 26 August 2013 at 23:32:26 UTC, Andre Artus wrote: On Monday, 26 August 2013 at 13:30:38 UTC, Alexandre wrote: Hi :) I'm starting with D language... and, I try to convert a C# code to D... So, my C# code, I get file informations, and, I create folders with all days of month of

Re: Using C/C++-DLL in D

2013-08-26 Thread S0urc3C0de
On Monday, 26 August 2013 at 23:33:52 UTC, Andrej Mitrovic wrote: Anyway, the safest bet is to use C functions to interface with C++. Okay, thank you, using C and compiling with gcc now works, but isn't there really any way to directly use a C++-Lib? Cause wrapping everything seems to be a

Re: Using C/C++-DLL in D

2013-08-26 Thread Andrej Mitrovic
On 8/27/13, S0urc3C0de s0urc3c0de@d.learn wrote: Actually, I was trying to use ffmpeg and isn't this a C-Lib? Seems so. Because when I tried to call a simple function (av_register_all()), I got the same error as described above though only with the leading underscore in the error message.

Re: Using C/C++-DLL in D

2013-08-26 Thread S0urc3C0de
On Tuesday, 27 August 2013 at 00:14:47 UTC, Andrej Mitrovic wrote: Try calling implib with the /s switch. Okay thanks, works now. Hopefully, there will be a safe way to use C++-Libs soon...

Re: Variant[Variant]

2013-08-26 Thread Ali Çehreli
On 08/24/2013 04:12 AM, Jason den Dulk wrote: Hi Straight off, I should ask if Variant[Variant] is a feasable idea. It looks like it: import std.variant; void main() { Variant[Variant] aa; aa[Variant(42)] = Variant(forty two); assert(Variant(42) in aa); assert(aa == [

How to cleanup after Socket.bind on Linux?

2013-08-26 Thread Ali Çehreli
The following simple socket example is trying to cleanup after itself, except the bind() call. As I repeat in the QUESTION comment below, I have read the man page of bind and I know that I need to unlink a path. How can I get that path? The program waits on localhost:8080, receives N number

why no to!bool(0) or to!bool(1) ?

2013-08-26 Thread growler
Is there any reason why the following code fails to compile? --- auto bfalse = to!bool(0); auto btrue = to!bool(1); --- dmd2/src/phobos/std/conv.d(329): Error: template std.conv.toImpl cannot deduce template function from argument types !(bool)(int) I can use a string, like so: --- auto bfalse

Re: How to cleanup after Socket.bind on Linux?

2013-08-26 Thread dnewbie
On Tuesday, 27 August 2013 at 03:30:11 UTC, Ali Çehreli wrote: It cannot be started a second time for 8080 still being in use, unless you wait for several seconds It works on Windows7, no need to wait.

Freshly Compiled DMD + Visual Studio

2013-08-26 Thread Meta
I decided to compile D from Github for the first time, and everything seemed to be working. I can build and run stuff fine from the command line. However, then I tried to make Visual Studio use my newly compiled DMD, and things blew up. I'm using VisualD 0.3.37. When I try to compile a small

Re: why no to!bool(0) or to!bool(1) ?

2013-08-26 Thread Jesse Phillips
On Tuesday, 27 August 2013 at 04:08:47 UTC, growler wrote: Is there any reason why the following code fails to compile? --- auto bfalse = to!bool(0); auto btrue = to!bool(1); --- dmd2/src/phobos/std/conv.d(329): Error: template std.conv.toImpl cannot deduce template function from argument types

Re: why no to!bool(0) or to!bool(1) ?

2013-08-26 Thread H. S. Teoh
On Tue, Aug 27, 2013 at 07:12:56AM +0200, Jesse Phillips wrote: On Tuesday, 27 August 2013 at 04:08:47 UTC, growler wrote: Is there any reason why the following code fails to compile? --- auto bfalse = to!bool(0); auto btrue = to!bool(1); --- dmd2/src/phobos/std/conv.d(329): Error:

Re: why no to!bool(0) or to!bool(1) ?

2013-08-26 Thread growler
On Tuesday, 27 August 2013 at 05:13:01 UTC, Jesse Phillips wrote: On Tuesday, 27 August 2013 at 04:08:47 UTC, growler wrote: Is there any reason why the following code fails to compile? --- auto bfalse = to!bool(0); auto btrue = to!bool(1); --- dmd2/src/phobos/std/conv.d(329): Error: template

Re: why no to!bool(0) or to!bool(1) ?

2013-08-26 Thread growler
On Tuesday, 27 August 2013 at 05:22:00 UTC, H. S. Teoh wrote: On Tue, Aug 27, 2013 at 07:12:56AM +0200, Jesse Phillips wrote: On Tuesday, 27 August 2013 at 04:08:47 UTC, growler wrote: Is there any reason why the following code fails to compile? --- auto bfalse = to!bool(0); auto btrue =