Re: alias and extern(C) for callbacks

2013-08-23 Thread Jacob Carlborg
On 2013-08-23 02:00, Andrej Mitrovic wrote: static assert(functionLinkage!test2 != C); // D calling convention Or Windows, Pascal or C++. -- /Jacob Carlborg

SysTime at compile time

2013-08-23 Thread Paolo Invernizzi
There's a way to use a SysTime at compile-time? It seems impossible right now for the presence of the TimeZone. I want to insert some time-related fields in some structs, but I need to have some compile-time check with 'static assert' here and there... Suggestions are welcome, thanks! Paolo

Re: alias and extern(C) for callbacks

2013-08-23 Thread Andrej Mitrovic
On 8/23/13, Jacob Carlborg d...@me.com wrote: On 2013-08-23 02:00, Andrej Mitrovic wrote: static assert(functionLinkage!test2 != C); // D calling convention Or Windows, Pascal or C++. I'd prefer if functionLinkage returned an enum, it's too easy to write c instead of C in some generic code

Re: alias and extern(C) for callbacks

2013-08-23 Thread Jacob Carlborg
On 2013-08-23 13:10, Andrej Mitrovic wrote: I'd prefer if functionLinkage returned an enum, it's too easy to write c instead of C in some generic code and have a static if branch not taken. Yeah, that's a good point. -- /Jacob Carlborg

Re: Associative array key order

2013-08-23 Thread Daniel Kozak
https://github.com/Kozzi11/Trash/blob/master/util/orderedaa.d On Thursday, 22 August 2013 at 08:41:13 UTC, monarch_dodra wrote: On Thursday, 22 August 2013 at 07:59:05 UTC, Daniel Kozak wrote: On Wednesday, 31 July 2013 at 14:55:55 UTC, Dicebot wrote: On Wednesday, 31 July 2013 at 14:43:21

Re: Associative array key order

2013-08-23 Thread Daniel Kozak
When I do some cleanups, I find some bugs and after fixing them, my own OrderedAA implementation does not beat builtin hash anymore :(. But speed is still really near to builtin AA's. On Thursday, 22 August 2013 at 07:59:05 UTC, Daniel Kozak wrote: On Wednesday, 31 July 2013 at 14:55:55 UTC,

pointers, null and Typedef...

2013-08-23 Thread John Colvin
so, here's the situation: current old code has: typedef const(void*) T0, T1; which is of course deprecated. context that needs to work: struct A { T0 t; this(T0 init) { t = init; } } Also, I need type-safety. is(T0 == T1) *must* be false. I have a modified Typedef

Re: Associative array key order

2013-08-23 Thread H. S. Teoh
On Fri, Aug 23, 2013 at 01:54:27PM +0200, Daniel Kozak wrote: https://github.com/Kozzi11/Trash/blob/master/util/orderedaa.d [...] Neat! Is a doubly-linked list really necessary for the hash buckets? You could save on some memory improve performance slightly if you use a singly-linked list for

Re: Associative array key order

2013-08-23 Thread bearophile
H. S. Teoh: ... On this subject, I added this request to Bugzilla: http://d.puremagic.com/issues/show_bug.cgi?id=10733 Bye, bearophile

Re: Associative array key order

2013-08-23 Thread bearophile
H. S. Teoh: ... Your answer was really too much short, so I have asked you a question in that enhancement request :-) Bye, bearophile

Re: Associative array key order

2013-08-23 Thread Sean Kelly
On Jul 31, 2013, at 7:55 AM, Dicebot pub...@dicebot.lv wrote: On Wednesday, 31 July 2013 at 14:43:21 UTC, Daniel Kozak wrote: is there a way for AA to behave same as PHP? I doubt it. This snippet suggests that AA's in PHP are not simply AA's and do additionally track insertion order (or

Re: pointers, null and Typedef...

2013-08-23 Thread Paolo Invernizzi
On Friday, 23 August 2013 at 12:17:08 UTC, John Colvin wrote: so, here's the situation: On 2.063.2 why not something like this: --- import std.typecons; alias T0 = Typedef!(void*, null, T0); alias T1 = Typedef!(void*, null, T1); static assert( ! is(T0 == T1)); struct A { T0 t; this(T0

Re: Associative array key order

2013-08-23 Thread H. S. Teoh
On Fri, Aug 23, 2013 at 11:22:47AM -0700, Sean Kelly wrote: On Jul 31, 2013, at 7:55 AM, Dicebot pub...@dicebot.lv wrote: On Wednesday, 31 July 2013 at 14:43:21 UTC, Daniel Kozak wrote: is there a way for AA to behave same as PHP? I doubt it. This snippet suggests that AA's in PHP are

Re: SysTime at compile time

2013-08-23 Thread Jonathan M Davis
On Friday, August 23, 2013 10:39:56 Paolo Invernizzi wrote: There's a way to use a SysTime at compile-time? It seems impossible right now for the presence of the TimeZone. I want to insert some time-related fields in some structs, but I need to have some compile-time check with 'static

InExpression with custom type?

2013-08-23 Thread Leandro Motta Barros
Hello! Is it possible to make an InExpression work with a used-defined type? struct MyCollection { ... } MyCollection mc; auto p = 123 in mc; if (p) { ... } Thanks! LMB

Re: InExpression with custom type?

2013-08-23 Thread Namespace
On Friday, 23 August 2013 at 19:57:42 UTC, Leandro Motta Barros wrote: Hello! Is it possible to make an InExpression work with a used-defined type? struct MyCollection { ... } MyCollection mc; auto p = 123 in mc; if (p) { ... } Thanks! LMB Yes, use opBinaryRight: T*

Re: InExpression with custom type?

2013-08-23 Thread Leandro Motta Barros
Thanks! LMB On Fri, Aug 23, 2013 at 4:59 PM, Namespace rswhi...@googlemail.com wrote: On Friday, 23 August 2013 at 19:57:42 UTC, Leandro Motta Barros wrote: Hello! Is it possible to make an InExpression work with a used-defined type? struct MyCollection { ... } MyCollection mc; auto

Re: Partially constructed objects in various languages

2013-08-23 Thread H. S. Teoh
On Tue, Aug 20, 2013 at 04:55:21AM +0200, bearophile wrote: Perhaps this thread deserves a D implementation with a small explanation regarding D: http://www.reddit.com/r/programming/comments/1kof0q/on_partiallyconstructed_objects/ (__ctWriteln is not yet available in D.) [...] One issue

Re: SysTime at compile time

2013-08-23 Thread Paolo Invernizzi
On Friday, 23 August 2013 at 19:07:06 UTC, Jonathan M Davis wrote: On Friday, August 23, 2013 10:39:56 Paolo Invernizzi wrote: There's a way to use a SysTime at compile-time? It seems impossible right now for the presence of the TimeZone. I want to insert some time-related fields in some

Template alias parameter: error: need 'this' for ...

2013-08-23 Thread Matej Nanut
Hello! I've run into this issue that I don't understand, maybe someone can enlighten me. :) This code: --- struct Thing { int i; } void main() { t!(Thing.i)(); } void t(alias a)() { return; } --- fails to compile with: ‘Error: need 'this' for 't' of type 'pure nothrow @safe

Re: Partially constructed objects in various languages

2013-08-23 Thread H. S. Teoh
On Fri, Aug 23, 2013 at 01:39:05PM -0700, H. S. Teoh wrote: On Tue, Aug 20, 2013 at 04:55:21AM +0200, bearophile wrote: Perhaps this thread deserves a D implementation with a small explanation regarding D:

Re: SysTime at compile time

2013-08-23 Thread Jonathan M Davis
On Friday, August 23, 2013 22:46:34 Paolo Invernizzi wrote: Thank you Jonathan, in reality I'm not interested in obtaining the current time ('Clock.currTIme' et similia), but only in checking some basic behaviour involving already forged times. Something works, in a limited and constrained

Re: Template alias parameter: error: need 'this' for ...

2013-08-23 Thread Jonathan M Davis
On Friday, August 23, 2013 23:28:46 Matej Nanut wrote: Hello! I've run into this issue that I don't understand, maybe someone can enlighten me. :) This code: --- struct Thing { int i; } void main() { t!(Thing.i)(); } void t(alias a)() { return; } --- fails to compile

is the tools part of the test suite? currently tools/ddemangle doesn't compile on git master

2013-08-23 Thread Timothee Cour
More often than not, the tools submodule ( https://github.com/D-Programming-Language/tools) will not build on git master. So I'm wondering whether it's even being tested before pushing commits. The error I have now is with ddemangle: std.md5 is scheduled for deprecation. Please use std.digest.md

Re: is the tools part of the test suite? currently tools/ddemangle doesn't compile on git master

2013-08-23 Thread H. S. Teoh
On Fri, Aug 23, 2013 at 08:20:29PM -0700, Timothee Cour wrote: More often than not, the tools submodule ( https://github.com/D-Programming-Language/tools) will not build on git master. So I'm wondering whether it's even being tested before pushing commits. The error I have now is with

Re: is the tools part of the test suite? currently tools/ddemangle doesn't compile on git master

2013-08-23 Thread Timothee Cour
sure, I'll file a bug, but I'd like to know whether the auto tester checks for these before a push is made to master: * tools * tools/update.sh (which is supposed to build everything) * docs each time i check, it fails in some new, creative ways On Fri, Aug 23, 2013 at 9:20 PM, H. S. Teoh