Re: Needing help with basic HTTP requests..

2013-07-10 Thread AlexMcP
Thank you! It worked, finally, and I can't believe that was the only thing stopping it from working. But yeah, I'll take your advice and make the changes. I've also looked at curl and your implementation, but I wanted to give this a go manually instead of just using external libraries, I

Re: How can i increase max number recursive template expansions?

2013-07-10 Thread Ellery Newcomer
On 07/07/2013 01:22 PM, John Colvin wrote: On Sunday, 7 July 2013 at 19:55:26 UTC, QAston wrote: I have a large enum in my code (opcodes for a protocol) - using std.traits.EnumMembers gives me a recursive template error. How can i increase max number recursive template expansions? I don't

Re: inverse of std.demangle?

2013-07-10 Thread Timothee Cour
ping? On Wed, Jul 3, 2013 at 5:42 PM, Timothee Cour thelastmamm...@gmail.comwrote: I'd like to have a function: string mangle(string mangled_string); unittest{ void foo(int x){} assert(foo.mangleof.demangle.mangle == foo.mangleof); } is there such a functionality, even partially?

Re: inverse of std.demangle?

2013-07-10 Thread Adam D. Ruppe
As far as I know, no such function exists (outside of dmd itself).

pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread JohnnyK
I hope you like the subject matter and I hope it is not too simplistic or have been answered before. Anyway I have a question about how the garbage collector works in a very specific situation. When passing string type to a function in a shared library or DLL and assigning it to a variable

Re: inverse of std.demangle?

2013-07-10 Thread Adam D. Ruppe
On Wednesday, 10 July 2013 at 16:30:25 UTC, Timothee Cour wrote: Do you have a pointer for that function in dmd ? The compiler doesn't do it as one function, I mean it can parse as string and mangle it in the process of compiling code. To go from demangled string = mangled string, you'd

Re: pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread Jacob Carlborg
On 2013-07-10 19:18, JohnnyK wrote: I hope you like the subject matter and I hope it is not too simplistic or have been answered before. Anyway I have a question about how the garbage collector works in a very specific situation. When passing string type to a function in a shared library or

Re: inverse of std.demangle?

2013-07-10 Thread Timothee Cour
Thanks much, that's a good start. Template support would definitely be needed as it's so common. This should go in std.demangle (or maybe a new std.mangle) * One use case is using it in shared libraries: user asks for a symbol via its demangled string representation (which is most natural for

Re: inverse of std.demangle?

2013-07-10 Thread Timothee Cour
On Wed, Jul 10, 2013 at 10:30 AM, Adam D. Ruppe destructiona...@gmail.comwrote: On Wednesday, 10 July 2013 at 16:30:25 UTC, Timothee Cour wrote: Do you have a pointer for that function in dmd ? The compiler doesn't do it as one function, I mean it can parse as string and mangle it in the

Re: pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread Namespace
A string in D, and all arrays, is a struct looking like this: struct Array (T) { T* ptr; size_t length; } I always thought it looks like this: struct Array(T) { T* ptr; size_t length, capacity; }

Re: C standard libraries

2013-07-10 Thread Timothee Cour
On Tue, Jul 2, 2013 at 5:52 AM, bearophile bearophileh...@lycos.com wrote: Adam D. Ruppe: The older std.c is kept around just for compatibility with the old names before the move, at least as far as I know. Maybe they haven't fully deprecated it though because there's other reasons I don't

Re: pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread Sean Kelly
On Jul 10, 2013, at 10:45 AM, Namespace rswhi...@googlemail.com wrote: A string in D, and all arrays, is a struct looking like this: struct Array (T) { T* ptr; size_t length; } I always thought it looks like this: struct Array(T) { T* ptr; size_t length, capacity; }

Re: inverse of std.demangle?

2013-07-10 Thread Sean Kelly
On Jul 10, 2013, at 10:44 AM, Timothee Cour thelastmamm...@gmail.com wrote: Thanks much, that's a good start. Template support would definitely be needed as it's so common. This should go in std.demangle (or maybe a new std.mangle) core.mangle/demangle. It would have to be done in a way that

Re: pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread Ali Çehreli
On 07/10/2013 11:10 AM, Sean Kelly wrote: On Jul 10, 2013, at 10:45 AM, Namespace rswhi...@googlemail.com wrote: A string in D, and all arrays, is a struct looking like this: struct Array (T) { T* ptr; size_t length; } I always thought it looks like this: struct Array(T) {

Re: Managing implementation details...

2013-07-10 Thread Timothee Cour
On Mon, Jul 8, 2013 at 2:00 AM, bearophile bearophileh...@lycos.com wrote: JS: I think when the code is compiled a report can be generated listing the priorities along with the locations in the file would be beneficial... It looks like a useful thing, on the other hand I think most

Re: pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread JohnnyK
On Wednesday, 10 July 2013 at 18:22:24 UTC, Ali Çehreli wrote: On 07/10/2013 11:10 AM, Sean Kelly wrote: On Jul 10, 2013, at 10:45 AM, Namespace rswhi...@googlemail.com wrote: A string in D, and all arrays, is a struct looking like this: struct Array (T) { T* ptr; size_t length;

Re: inverse of std.demangle?

2013-07-10 Thread Adam D. Ruppe
On Wednesday, 10 July 2013 at 17:44:51 UTC, Timothee Cour wrote: * One use case is using it in shared libraries: user asks for a symbol via its demangled string representation (which is most natural for user), then the string is mangled, and then calls dlsym to retrieve the actual pointer to

Re: pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread H. S. Teoh
On Wed, Jul 10, 2013 at 07:45:25PM +0200, Namespace wrote: A string in D, and all arrays, is a struct looking like this: struct Array (T) { T* ptr; size_t length; } I always thought it looks like this: struct Array(T) { T* ptr; size_t length, capacity; } Nope, the

Re: pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread H. S. Teoh
On Wed, Jul 10, 2013 at 08:38:40PM +0200, JohnnyK wrote: [...] Reminds me of how Delphi (aka Pascal) strings are work. Thanks everyone this answers some of my questions. Now what about when the return type of a function is a string? Is D returning the pointer to the string structure or is

Re: inverse of std.demangle?

2013-07-10 Thread Timothee Cour
On Wed, Jul 10, 2013 at 11:39 AM, Adam D. Ruppe destructiona...@gmail.comwrote: On Wednesday, 10 July 2013 at 17:44:51 UTC, Timothee Cour wrote: * One use case is using it in shared libraries: user asks for a symbol via its demangled string representation (which is most natural for user),

Re: inverse of std.demangle?

2013-07-10 Thread Adam D. Ruppe
On Wednesday, 10 July 2013 at 19:03:22 UTC, Timothee Cour wrote: How would that work, since this is runtime only? Take a pointer with the right type and then attach the rest of the name to it. Given: int foo(int a, string) { return a;} void main() { int function(int, string)

Re: Help me investigate a bug to file it.

2013-07-10 Thread monarch_dodra
On Tuesday, 9 July 2013 at 00:06:11 UTC, Artur Skawina wrote: That plus a non-existing this._input, results in a bit (too much) magic, and the first test passes. The other one fails because of the '$' (ie opDollar() call). artur In any case, it is now filed:

Re: Building from source for ubuntu

2013-07-10 Thread monarch_dodra
More questions related to running on ubuntu. I'd like to have side by side installs of dmd. Eg 2.060, 2.061 ... I installed using the downloadable packages. dmd and rdmd are in /usr/bin druntime and phobos are in dmd, which is in /usr/include Currently, I have 2.063 installed, and would like

Re: pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread Jonathan M Davis
On Wednesday, July 10, 2013 20:38:40 JohnnyK wrote: Reminds me of how Delphi (aka Pascal) strings are work. Thanks everyone this answers some of my questions. Now what about when the return type of a function is a string? Is D returning the pointer to the string structure or is it returning

Re: pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread JohnnyK
On Wednesday, 10 July 2013 at 18:45:56 UTC, H. S. Teoh wrote: On Wed, Jul 10, 2013 at 08:38:40PM +0200, JohnnyK wrote: [...] Reminds me of how Delphi (aka Pascal) strings are work. Thanks everyone this answers some of my questions. Now what about when the return type of a function is a

Re: Building from source for ubuntu

2013-07-10 Thread H. S. Teoh
On Wed, Jul 10, 2013 at 09:40:57PM +0200, monarch_dodra wrote: More questions related to running on ubuntu. I'd like to have side by side installs of dmd. Eg 2.060, 2.061 ... I installed using the downloadable packages. dmd and rdmd are in /usr/bin druntime and phobos are in dmd, which is

Re: pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread John Colvin
On Wednesday, 10 July 2013 at 17:18:09 UTC, JohnnyK wrote: I hope you like the subject matter and I hope it is not too simplistic or have been answered before. Anyway I have a question about how the garbage collector works in a very specific situation. When passing string type to a function

Re: Help me investigate a bug to file it.

2013-07-10 Thread Artur Skawina
On 07/10/13 21:36, monarch_dodra wrote: On Tuesday, 9 July 2013 at 00:06:11 UTC, Artur Skawina wrote: That plus a non-existing this._input, results in a bit (too much) magic, and the first test passes. The other one fails because of the '$' (ie opDollar() call). In any case, it is now filed:

Re: Building from source for ubuntu

2013-07-10 Thread John Colvin
On Wednesday, 10 July 2013 at 19:40:58 UTC, monarch_dodra wrote: More questions related to running on ubuntu. I'd like to have side by side installs of dmd. Eg 2.060, 2.061 ... I installed using the downloadable packages. dmd and rdmd are in /usr/bin druntime and phobos are in dmd, which is

Re: Building from source for ubuntu

2013-07-10 Thread monarch_dodra
On Wednesday, 10 July 2013 at 20:21:10 UTC, H. S. Teoh wrote: On Wed, Jul 10, 2013 at 09:40:57PM +0200, monarch_dodra wrote: More questions related to running on ubuntu. I'd like to have side by side installs of dmd. Eg 2.060, 2.061 ... I installed using the downloadable packages. dmd and

Re: Building from source for ubuntu

2013-07-10 Thread Jonathan M Davis
On Wednesday, July 10, 2013 13:19:33 H. S. Teoh wrote: How do you coax different versions of dmd to pick up a different dmd.conf file? The last time I tried it, all of them insisted on reading /etc/dmd.conf, which, of course, only actually works for one. To quote the website

A range analysis question

2013-07-10 Thread bearophile
Do you know why the assignment to 'item' is accepted in the first case and refused in the second? ubyte generate1(s...)() { ubyte[10] result; foreach (immutable i, ref item; result) item = s[0][0] 4; return result[0]; } ubyte generate2(s...)() { ubyte[10] result;

Tuple indexing and slicing

2013-07-10 Thread Timothee Cour
Why not support Tuple indexing and slicing with [] syntax? (see below for a way to index/slice a tuple) void main(){ alias T=Tuple!(int,double); pragma(msg,T[0].stringof);//_expand_field_0 //pragma(msg,T[0..2].stringof); //Error: cannot slice type 'Tuple!(int, double)

Re: A range analysis question

2013-07-10 Thread bearophile
Ali Çehreli: Change the code so that the result does not fit a ubyte you will get the same error as in line 11. The result is supposed to fit in an ubyte because the input is supposed to be made of nibbles. (I have tried to add asserts or tests, but they don't change the situation, so I

Re: Tuple indexing and slicing

2013-07-10 Thread bearophile
Timothee Cour: Why not support Tuple indexing and slicing with [] syntax? You need a syntax like: a.slice!(1, 3); I don't know why Walter didn't add support for a slicing syntax for tuples. But it's an additive change, so it's not too much late to add it, if it's feasible. If D will grow

Re: A range analysis question

2013-07-10 Thread Ali Çehreli
On 07/10/2013 04:10 PM, bearophile wrote: Ali Çehreli: Change the code so that the result does not fit a ubyte you will get the same error as in line 11. The result is supposed to fit in an ubyte because the input is supposed to be made of nibbles. Not in either of the two cases that I

Re: A range analysis question

2013-07-10 Thread bearophile
Ali Çehreli: That would be great but there are many other cases where the compiler does not do anything like that. Here, it would have to decide similar to even though this is a runtime foreach, I know at compile time that 'result' is a fixed-length array so 'i' is between 0 and 10. I also

Re: Tuple indexing and slicing

2013-07-10 Thread Artur Skawina
On 07/11/13 00:52, Timothee Cour wrote: Why not support Tuple indexing and slicing with [] syntax? (see below for a way to index/slice a tuple) Not sure I understand the question. I guess you'd like this to work for some library pseudo-tuple type - I've not looked at those, somebody else may

Re: Tuple indexing and slicing

2013-07-10 Thread Timothee Cour
On Wed, Jul 10, 2013 at 5:49 PM, Artur Skawina art.08...@gmail.com wrote: On 07/11/13 00:52, Timothee Cour wrote: Why not support Tuple indexing and slicing with [] syntax? (see below for a way to index/slice a tuple) Not sure I understand the question. I guess you'd like this to work

Re: Tuple indexing and slicing

2013-07-10 Thread Jonathan M Davis
On Wednesday, July 10, 2013 18:10:42 Timothee Cour wrote: On Wed, Jul 10, 2013 at 5:49 PM, Artur Skawina art.08...@gmail.com wrote: On 07/11/13 00:52, Timothee Cour wrote: Why not support Tuple indexing and slicing with [] syntax? (see below for a way to index/slice a tuple) Not

Re: inverse of std.demangle?

2013-07-10 Thread Adam D. Ruppe
On Wednesday, 10 July 2013 at 18:10:19 UTC, Sean Kelly wrote: It would have to be done in a way that avoided allocating though (similar to core.demangle), to be in core. This would be really easy to do if enum string[] = [...]; didn't allocate at runtime. Unbelievable.

Re: inverse of std.demangle?

2013-07-10 Thread H. S. Teoh
On Thu, Jul 11, 2013 at 03:24:05AM +0200, Adam D. Ruppe wrote: On Wednesday, 10 July 2013 at 18:10:19 UTC, Sean Kelly wrote: It would have to be done in a way that avoided allocating though (similar to core.demangle), to be in core. This would be really easy to do if enum string[] = [...];

Re: pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread Jesse Phillips
On Wednesday, 10 July 2013 at 17:18:09 UTC, JohnnyK wrote: export string mytest(string tstStr) { string st = tstStr; /* abbreviated to protect the innocent but other operations such as concatenating and deleting may be done to st before the return */ return st; } Arrays are

Re: Tuple indexing and slicing

2013-07-10 Thread Timothee Cour
On Wed, Jul 10, 2013 at 6:16 PM, Jonathan M Davis jmdavisp...@gmx.comwrote: On Wednesday, July 10, 2013 18:10:42 Timothee Cour wrote: On Wed, Jul 10, 2013 at 5:49 PM, Artur Skawina art.08...@gmail.com wrote: On 07/11/13 00:52, Timothee Cour wrote: Why not support Tuple indexing and

Re: pointers, assignments, Garbage Collection Oh My?

2013-07-10 Thread Maxim Fomin
On Wednesday, 10 July 2013 at 18:22:24 UTC, Ali Çehreli wrote: And to be pedantic, length comes first: struct Array (T) { size_t length; T* ptr; } Which is actually property-like because assigning to length does pretty complex stuff. So the member cannot be named as 'length':