Re: Typed Message Passing between D Processes

2015-07-29 Thread yawniek via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 16:36:41 UTC, Atila Neves wrote: LDC: Cerealed: 970 ms, 482 μs, and 6 hnsecs MsgPack: 896 ms, 591 μs, and 2 hnsecs Not too shabby! Atila cool. what are the advantages of cereald over msgpack? can you stream in packets with cereald too? cool thing about msgpack

Re: How disruptive is the GC?

2015-07-29 Thread Kapps via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 17:09:52 UTC, Namespace wrote: On Wednesday, 29 July 2015 at 09:25:50 UTC, Snape wrote: I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of p

Compiling a DLL with DMC

2015-07-29 Thread Mike Parker via Digitalmars-d-learn
I'm trying to compile a DLL using DMC for use in a sample DMD program, but the link stage keeps failing and I can't figure out why. The C source: ``` #include #ifdef __DMC__ #define WIN32_LEAN_AND_MEAN #include BOOL APIENTRY DllMain(HANDLE hModule, DWORD reason, LPVOID lpReserved) { sw

Re: Changes on dynamic shared library writing

2015-07-29 Thread tcak via Digitalmars-d-learn
On Thursday, 30 July 2015 at 03:52:16 UTC, Rikki Cattermole wrote: On 30/07/2015 8:27 a.m., tcak wrote: On Wednesday, 29 July 2015 at 19:41:14 UTC, tcak wrote: After a long time (Failed many times before), I checked the page http://dlang.org/dll-linux.html again. It shows a message on top say

Re: Changes on dynamic shared library writing

2015-07-29 Thread Rikki Cattermole via Digitalmars-d-learn
On 30/07/2015 8:27 a.m., tcak wrote: On Wednesday, 29 July 2015 at 19:41:14 UTC, tcak wrote: After a long time (Failed many times before), I checked the page http://dlang.org/dll-linux.html again. It shows a message on top saying that preliminary and subject to change. Exactly what changes are

Re: Type inference of a function parameter

2015-07-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 20:20:47 UTC, Adel Mamin wrote: Hello, Why dmd cannot inference the type of 'arr' in my_func() parameter? test.d: import std.stdio; void my_func(auto arr) { writeln(arr); } void main() { auto arr = new int[5]; arr = [1, 2, 3, 4, 5]; my_func(arr); }

Re: extern(C) with function returning user type

2015-07-29 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 18:42:45 UTC, Kyoji Klyden wrote: Thanks for the replies, This issue really highlights one of D's weak points I think. I've atleast got a round about solution almost working. :P Really? I see it as one of D's strengths. It's much easier to connect D with C than

Re: How to make a standalone .a using dub?

2015-07-29 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 30 July 2015 at 00:14:23 UTC, Yuxuan Shui wrote: Is there a way to have dub pack the library along with all its dependencies into a single .a? And if not, is there any D build system capable of doing this? reggae maybe?

How to make a standalone .a using dub?

2015-07-29 Thread Yuxuan Shui via Digitalmars-d-learn
Is there a way to have dub pack the library along with all its dependencies into a single .a?

Re: forward range properties with alias this - how?

2015-07-29 Thread Ivan Kazmenko via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 23:54:29 UTC, Ivan Kazmenko wrote: On Wednesday, 29 July 2015 at 12:25:14 UTC, Marc Schütz wrote: On Tuesday, 28 July 2015 at 21:25:23 UTC, Ivan Kazmenko wrote: ... Perhaps I still don't implement save() correctly. The line @property auto save() {return S(con

Re: forward range properties with alias this - how?

2015-07-29 Thread Ivan Kazmenko via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 12:25:14 UTC, Marc Schütz wrote: On Tuesday, 28 July 2015 at 21:25:23 UTC, Ivan Kazmenko wrote: Hello, I wrap an array into a struct. Then I use alias this to expose the array functionality. Sadly, range properties of the array are not forwarded, and so I can't

Re: Error: 'this' is only defined in non-static member functions, not main

2015-07-29 Thread remi thebault via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 22:12:38 UTC, anonymous wrote: Slapping `static` on `get` seems to make it work: static size_t get() {return member.offsetof;} Good slap, thanks! you solved my problem I guess the compiler thinks that since `item.link` is an instance member, it ne

Re: Compare types with `static if` in template function.

2015-07-29 Thread Ali Çehreli via Digitalmars-d-learn
On 07/29/2015 11:54 AM, vladde wrote: On Wednesday, 29 July 2015 at 18:14:11 UTC, Ali Çehreli wrote: else if(is(typeof(c) == fg)) { // slots[xy.y][xy.x].fg = C; } The error occurs when the commented line is run. The full code can be viewed at https://github.

Re: Error: 'this' is only defined in non-static member functions, not main

2015-07-29 Thread anonymous via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 21:33:16 UTC, remi thebault wrote: Hello I have this weird error trying to achieve something simple: That's far from simple. Here's a reduction: template wl_container_of(alias member) { size_t get() {return member.offsetof;} } struct item { int link; }

Error: 'this' is only defined in non-static member functions, not main

2015-07-29 Thread remi thebault via Digitalmars-d-learn
Hello I have this weird error trying to achieve something simple: module list_test; // import wayland.util; template Id(alias a) { alias Id = a; } template ParentOf(alias member) { alias ParentOf = Id!(__traits(parent, member)); } template wl_container_of(alias member) { ParentOf

Re: Type inference of a function parameter

2015-07-29 Thread anonymous via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 20:20:47 UTC, Adel Mamin wrote: void my_func(auto arr) { writeln(arr); } There are no `auto` parameters in D. You have to make it a template explicitly: void my_func(A)(A arr) { writeln(arr); }

Re: Changes on dynamic shared library writing

2015-07-29 Thread tcak via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 19:41:14 UTC, tcak wrote: After a long time (Failed many times before), I checked the page http://dlang.org/dll-linux.html again. It shows a message on top saying that preliminary and subject to change. Exactly what changes are expected? Where can I learn about t

Type inference of a function parameter

2015-07-29 Thread Adel Mamin via Digitalmars-d-learn
Hello, Why dmd cannot inference the type of 'arr' in my_func() parameter? test.d: import std.stdio; void my_func(auto arr) { writeln(arr); } void main() { auto arr = new int[5]; arr = [1, 2, 3, 4, 5]; my_func(arr); } dmd test.d test.d(3): Error: undefined identifier arr Adel

Changes on dynamic shared library writing

2015-07-29 Thread tcak via Digitalmars-d-learn
After a long time (Failed many times before), I checked the page http://dlang.org/dll-linux.html again. It shows a message on top saying that preliminary and subject to change. Exactly what changes are expected? Where can I learn about them? I would do tests again with dynamic library writing

Re: Struct that destroys its original handle on copy-by-value

2015-07-29 Thread Vlad Levenfeld via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 19:10:36 UTC, Adam D. Ruppe wrote: On Sunday, 26 July 2015 at 12:16:30 UTC, Joseph Rushton Wakeling wrote: My aim by contrast is to _allow_ that kind of use, but render the original handle empty when it's done. I don't think D offers any way to do that. With the d

Re: Struct that destroys its original handle on copy-by-value

2015-07-29 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 26 July 2015 at 12:16:30 UTC, Joseph Rushton Wakeling wrote: My aim by contrast is to _allow_ that kind of use, but render the original handle empty when it's done. I don't think D offers any way to do that. With the disabled postblit, you can force people into a method you write th

Re: Compare types with `static if` in template function.

2015-07-29 Thread vladde via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 18:14:11 UTC, Ali Çehreli wrote: else if(is(typeof(c) == fg)) { // slots[xy.y][xy.x].fg = C; } The error occurs when the commented line is run. The full code can be viewed at https://github.com/vladdeSV/clayers/blob/change-slot

Re: Struct that destroys its original handle on copy-by-value

2015-07-29 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Sunday, 26 July 2015 at 11:30:16 UTC, Joseph Rushton Wakeling wrote: Hello all, A design question that came up during the hackathon held during the last Berlin D Meetup. [...] Ping on the above -- nobody has any insight...?

Re: extern(C) with function returning user type

2015-07-29 Thread Kyoji Klyden via Digitalmars-d-learn
Thanks for the replies, This issue really highlights one of D's weak points I think. I've atleast got a round about solution almost working. :P

Re: No Unix socket support?

2015-07-29 Thread tcak via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 13:39:33 UTC, simendsjo wrote: Is there no Unix socket support in Phobos? Or vibe? Or any other library? I've found some discussions: * https://issues.dlang.org/show_bug.cgi?id=9384 * http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/10870/ ,

Re: extern(C) with function returning user type

2015-07-29 Thread anonymous via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 17:59:26 UTC, Kyoji Klyden wrote: How would I use a C function that's returning a struct? auto doesn't work here, and from what I can tell D can't import C headers. (If it really can't then, that would be a very welcome feature) I do have the required libs but I

Re: extern(C) with function returning user type

2015-07-29 Thread Ali Çehreli via Digitalmars-d-learn
On 07/29/2015 10:59 AM, Kyoji Klyden wrote: > How would I use a C function that's returning a struct? The binding file must have a matching D struct. > auto doesn't > work here, and from what I can tell D can't import C headers. (If it > really can't then, that would be a very welcome feature)

Re: extern(C) with function returning user type

2015-07-29 Thread yawniek via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 17:59:26 UTC, Kyoji Klyden wrote: How would I use a C function that's returning a struct? auto doesn't work here, and from what I can tell D can't import C headers. (If it really can't then, that would be a very welcome feature) I do have the required libs but I

Re: Compare types with `static if` in template function.

2015-07-29 Thread Ali Çehreli via Digitalmars-d-learn
On 07/29/2015 11:08 AM, vladde wrote: On Wednesday, 29 July 2015 at 18:04:48 UTC, vladde wrote: Apparently, if I only check for a character the code compiles without the need of static if. if(is(typeof(c) == dchar) || is(typeof(c) == char)){ slots[xy.y][xy.x].character = c; } //Compiles and wor

Re: Compare types with `static if` in template function.

2015-07-29 Thread vladde via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 18:04:48 UTC, vladde wrote: Apparently, if I only check for a character the code compiles without the need of static if. if(is(typeof(c) == dchar) || is(typeof(c) == char)){ slots[xy.y][xy.x].character = c; } //Compiles and works as expected And changing all if

Re: Compare types with `static if` in template function.

2015-07-29 Thread vladde via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 17:52:45 UTC, Ali Çehreli wrote: On 07/29/2015 10:48 AM, vladde wrote: > static if(is(typeof(c) == dchar) || is(typeof(c) == char)) > { > slots[xy.y][xy.x].character = c; > } > else if(is(typeof(c) == fg)) I don't kn

extern(C) with function returning user type

2015-07-29 Thread Kyoji Klyden via Digitalmars-d-learn
How would I use a C function that's returning a struct? auto doesn't work here, and from what I can tell D can't import C headers. (If it really can't then, that would be a very welcome feature) I do have the required libs but I can't create my D obj file so I can't really get there. I know

Re: Compare types with `static if` in template function.

2015-07-29 Thread Ali Çehreli via Digitalmars-d-learn
On 07/29/2015 10:48 AM, vladde wrote: > static if(is(typeof(c) == dchar) || is(typeof(c) == char)) > { > slots[xy.y][xy.x].character = c; > } > else if(is(typeof(c) == fg)) I don't know whether it is the reason here but you fell for one of the D

Compare types with `static if` in template function.

2015-07-29 Thread vladde via Digitalmars-d-learn
I want to have a template function where I can throw in some stuff in the parameters, then run foreach+static ifs and check what type the current is. From my project clayers[1], I've taken out some parts. (Note the current code does not compile.) This is what I have so far: struct XY {size_t

Re: Dynamic memory

2015-07-29 Thread Binarydepth via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 08:03:06 UTC, anonymous wrote: int[2][] is exactly an dynamic array of (arrays with the length 2), the logic behind this notation is: 1. Array of 2 int -> int[2] 2. a dynamic array of 1. -> int[2][] (like SomeType[] is an array of SomeType) Thank you!

Re: How disruptive is the GC?

2015-07-29 Thread Namespace via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 09:25:50 UTC, Snape wrote: I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of people have said lots of things about it, but some of that inf

Re: Typed Message Passing between D Processes

2015-07-29 Thread Atila Neves via Digitalmars-d-learn
On Monday, 29 June 2015 at 13:59:37 UTC, Nordlöw wrote: On Monday, 29 June 2015 at 10:22:10 UTC, Atila Neves wrote: I guess I'm going to have benchmark this now... :) What about doing a memory profiling using DMD fresh builtin profiler of http://dpaste.dzfl.pl/17b0ed9c0204 ? I'm guessing

Re: Typed Message Passing between D Processes

2015-07-29 Thread Atila Neves via Digitalmars-d-learn
On Monday, 29 June 2015 at 10:22:10 UTC, Atila Neves wrote: On Monday, 29 June 2015 at 08:45:15 UTC, Atila Neves wrote: On Sunday, 28 June 2015 at 17:02:42 UTC, Nordlöw wrote: On Friday, 26 June 2015 at 21:40:49 UTC, Atila Neves wrote: I'd have to benchmark it against something, but I'm pretty

Re: Yes or No Options

2015-07-29 Thread Chris via Digitalmars-d-learn
On Monday, 27 July 2015 at 15:50:11 UTC, Alex wrote: Hey guys! I am super new to programming and still trying to learn the very basics via a book that I bought. Out of interest: what made you start with D? It's not the most obvious choice for a programming novice.

Re: No Unix socket support?

2015-07-29 Thread Dragos Carp via Digitalmars-d-learn
On Wednesday, 29 July 2015 at 13:39:33 UTC, simendsjo wrote: Is there no Unix socket support in Phobos? Or vibe? Or any other library? I've found some discussions: * https://issues.dlang.org/show_bug.cgi?id=9384 * http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/10870/ ,

Re: No Unix socket support?

2015-07-29 Thread via Digitalmars-d-learn
On Wed, Jul 29, 2015 at 01:39:31PM +, simendsjo via Digitalmars-d-learn wrote: > Is there no Unix socket support in Phobos? No, there's plenty of support. Just use a unix address when making a socket. I used it in my terminal emulator: https://github.com/adamdruppe/terminal-emulator/blob/ma

No Unix socket support?

2015-07-29 Thread simendsjo via Digitalmars-d-learn
Is there no Unix socket support in Phobos? Or vibe? Or any other library? I've found some discussions: * https://issues.dlang.org/show_bug.cgi?id=9384 * http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/10870/ , but it seems there are no support yet.

Re: forward range properties with alias this - how?

2015-07-29 Thread via Digitalmars-d-learn
On Tuesday, 28 July 2015 at 21:25:23 UTC, Ivan Kazmenko wrote: Hello, I wrap an array into a struct. Then I use alias this to expose the array functionality. Sadly, range properties of the array are not forwarded, and so I can't use the struct as an array with functions from std.algorithm a

Re: How disruptive is the GC?

2015-07-29 Thread Rikki Cattermole via Digitalmars-d-learn
On 29/07/2015 9:25 p.m., Snape wrote: I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of people have said lots of things about it, but some of that information is old, so a

How disruptive is the GC?

2015-07-29 Thread Snape via Digitalmars-d-learn
I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of people have said lots of things about it, but some of that information is old, so as of today, what effect does the GC

Re: Dynamic memory

2015-07-29 Thread anonymous via Digitalmars-d-learn
On Tuesday, 28 July 2015 at 22:52:31 UTC, Binarydepth wrote: I'm reading the reference : http://dlang.org/arrays.html And I'm declaring two dynamic arrays as I understand. What I had in mind was declaring a dynamic array of two elements each. int[2][] is exactly an dynamic array of (arrays wi