Re: __traits(compiles) + mixin

2013-03-05 Thread Andrej Mitrovic
On Tuesday, 5 March 2013 at 07:53:15 UTC, cal wrote: I'm confused about this: import std.conv; void main() { enum s = `1`.to!int;; enum c = __traits(compiles, mixin({auto a = new ~s~;})); // line 1 mixin(auto a = ~s~;); // line 2 } This does not compile, giving errors about

Re: __traits(compiles) + mixin

2013-03-05 Thread cal
On Tuesday, 5 March 2013 at 08:04:12 UTC, Andrej Mitrovic wrote: You can't test declarations inside of __traits(compiles), only expressions. It's in the docs: http://dlang.org/traits.html#compiles So why does this work: import std.conv; void main() { enum s = `1`.to!int;; enum c =

Re: __traits(compiles) + mixin

2013-03-05 Thread simendsjo
On Tuesday, 5 March 2013 at 08:09:37 UTC, cal wrote: On Tuesday, 5 March 2013 at 08:04:12 UTC, Andrej Mitrovic wrote: You can't test declarations inside of __traits(compiles), only expressions. It's in the docs: http://dlang.org/traits.html#compiles So why does this work: import std.conv;

Re: __traits(compiles) + mixin

2013-03-05 Thread simendsjo
On Tuesday, 5 March 2013 at 08:04:12 UTC, Andrej Mitrovic wrote: On Tuesday, 5 March 2013 at 07:53:15 UTC, cal wrote: I'm confused about this: import std.conv; void main() { enum s = `1`.to!int;; enum c = __traits(compiles, mixin({auto a = new ~s~;})); // line 1 mixin(auto a =

Re: __traits(compiles) + mixin

2013-03-05 Thread Andrej Mitrovic
On 3/5/13, cal callumena...@gmail.com wrote: So why does this work: import std.conv; void main() { enum s = `1`.to!int;; enum c = __traits(compiles, mixin({auto x = ~s~;})); // true } That's a function literal, i.e. an expression.

Re: __traits(compiles) + mixin

2013-03-05 Thread cal
On Tuesday, 5 March 2013 at 08:14:58 UTC, simendsjo wrote: Hmm.. And this also works: enum c = __traits(compiles, mixin({auto a = new 1;})); Something to do with CTFE combined with mixins? But it gets this right, in that c is false. I had thought that by wrapping the declaration in braces,

Re: A little of coordination for Rosettacode

2013-03-05 Thread Jos van Uden
On 5-3-2013 2:05, bearophile wrote: But if you fear that, then I've added private to all global identifiers: http://rosettacode.org/wiki/Simple_database#D I have removed private again, because it's bad to program compromises. This is a complete program, it's not a module, and it's not

Re: A little of coordination for Rosettacode

2013-03-05 Thread Jos van Uden
On 5-3-2013 11:45, Jos van Uden wrote: On 5-3-2013 2:05, bearophile wrote: But if you fear that, then I've added private to all global identifiers: http://rosettacode.org/wiki/Simple_database#D I have removed private again, because it's bad to program compromises. This is a complete program,

Re: __traits(compiles) + mixin

2013-03-05 Thread Timon Gehr
On 03/05/2013 08:53 AM, cal wrote: I'm confused about this: import std.conv; void main() { enum s = `1`.to!int;; enum c = __traits(compiles, mixin({auto a = new ~s~;})); // line 1 mixin(auto a = ~s~;); // line 2 } This does not compile, giving errors about instantiating

Re: A little of coordination for Rosettacode

2013-03-05 Thread bearophile
Jos van Uden: // this shouldn't happen test.d import simdb; If I try to compile something like that my dmd gives me a duplicated main error, or something similar. I really mean: test.d void fun() { auto db = load(); // etc store(db); } simdb.d import test; fun();

Re: wxD - dead or alive?

2013-03-05 Thread Matthew Caron
On 03/04/2013 11:24 AM, SaltySugar wrote: On Monday, 4 March 2013 at 13:25:22 UTC, Matthew Caron wrote: On 03/03/2013 08:16 AM, SaltySugar wrote: wxD - dead or alive? I've been using it. What makes you think that it's dead? Because It's latest release was at 2011-08-26 In all fairness, I

Re: A little of coordination for Rosettacode

2013-03-05 Thread Jos van Uden
On Tuesday, 5 March 2013 at 13:12:49 UTC, bearophile wrote: Jos van Uden: // this shouldn't happen test.d import simdb; If I try to compile something like that my dmd gives me a duplicated main error, or something similar. Sorry, that was a wrong example. I really mean: test.d void

Re: __traits(compiles) + mixin

2013-03-05 Thread cal
On Tuesday, 5 March 2013 at 12:58:57 UTC, Timon Gehr wrote: Compiles as expected with DMD 2.060. It is probably a regression. Ah you're right, also with 2.061. I'll file.

Re: map! filter! and range algorithm

2013-03-05 Thread Russel Winder
On Mon, 2013-03-04 at 12:24 -0800, H. S. Teoh wrote: […] Is there a way to parallelize this kind of operations? What do you mean by parallelize? Run in multiple threads? I don't think you can do that, because the result of filter depends on what it gets from map. This shows the deficiency

Re: To lessen the function pointers/delegates distinction

2013-03-05 Thread David
Am 05.03.2013 03:36, schrieb bearophile: I am thinking about one enhancement request, but I am not sure if the idea is meaningful, so I show it here first. The presence of both function pointers and delegates makes the usage of higher order functions harder in D compared to function

Re: To lessen the function pointers/delegates distinction

2013-03-05 Thread Jakob Ovrum
On Tuesday, 5 March 2013 at 02:36:45 UTC, bearophile wrote: I am thinking about one enhancement request, but I am not sure if the idea is meaningful, so I show it here first. The problem here is that the D calling convention for functions is different from that of delegates for whatever

Re: What xml libraries are people using?

2013-03-05 Thread Jesse Phillips
On Monday, 4 March 2013 at 04:45:45 UTC, Brad Roberts wrote: Has this implementation been bounced off the w3c xml test suite? I don't know, but the xml tests don't seem to be the those provided by W3C http://bazaar.launchpad.net/~michael-rynn-500/d2-xml/d2-xml-dev/files/head:/test/xmltest/

Re: map! filter! and range algorithm

2013-03-05 Thread H. S. Teoh
On Wed, Mar 06, 2013 at 03:11:42AM +0100, Jesse Phillips wrote: On Monday, 4 March 2013 at 20:49:22 UTC, Andrea Fontana wrote: Very interesting. IMHO that should be pointed out better in docs/example. You say interleaving is default, how can I guess if a function doesn't use the default

Re: map! filter! and range algorithm

2013-03-05 Thread bearophile
H. S. Teoh: A range is an abstraction akin to C++'s iterators (except better, IMO). Stepanov himself has commented very briefly about Alexandrescu/D Ranges in one of his video lessons. I have not fully understood what Stepanov has said with those few words spoken in a not so good English

Re: map! filter! and range algorithm

2013-03-05 Thread H. S. Teoh
On Wed, Mar 06, 2013 at 04:25:33AM +0100, bearophile wrote: [...] Stepanov himself has commented very briefly about Alexandrescu/D Ranges in one of his video lessons. I have not fully understood what Stepanov has said with those few words spoken in a not so good English (not because of