Re: Troublemaker dmd 2.061 - Templates?

2013-01-05 Thread Ali Çehreli
On 01/05/2013 08:52 AM, David wrote: http://dpaste.dzfl.pl/d703d10e (code from above) That is equally incomplete. :) Could you please also provide surrounding code that would help us reproduce this issue? At the minimum, the import lines and a main() function will be helpful. Thank you,

Re: Troublemaker dmd 2.061 - Templates?

2013-01-05 Thread David
Am 05.01.2013 17:57, schrieb Ali Çehreli: On 01/05/2013 08:52 AM, David wrote: http://dpaste.dzfl.pl/d703d10e (code from above) That is equally incomplete. :) Could you please also provide surrounding code that would help us reproduce this issue? At the minimum, the import lines and a

Re: Troublemaker dmd 2.061 - Templates?

2013-01-05 Thread David
LOL mixin template get_packets_mixin(alias Module) { template get_packets() { alias NoDuplicates!(get_packets_impl!(get_members!())) get_packets; } template get_members() { alias TypeTuple!(__traits(allMembers, Module)) get_members; } private template

Customizing ddoc from cmd-line

2013-01-05 Thread Peter Sommerfeld
I seem to be unable to customize DDoc from the command line. Suppose the sources are in src, docs in doc. Here is my command line (Win7 if that matters): dmd -D -Dddoc doc/my.ddoc src/main.d Nothing happens... What I would like to do is to add a style sheet as described in

Why is immutable not possible as a result of a reduce expression?

2013-01-05 Thread Michael Engelhardt
Hi, just playing around with the functional capabilities of D. One concept of the pure functional programming is that variables should not be reassigned, so the best(?) way to assure this is using immutable: immutable auto gen = sequence!(n); immutable auto seq = take(gen,10);

Re: Customizing ddoc from cmd-line

2013-01-05 Thread Peter Sommerfeld
Am 05.01.2013, 20:23 Uhr, schrieb Peter Sommerfeld nore...@rubrica.at: Nothing happens... Sorry, I was imprecise. Of course, the executable as well as the html was generated but my.ddoc had no effect. Peter

Re: Why is immutable not possible as a result of a reduce expression?

2013-01-05 Thread Simen Kjaeraas
On 2013-52-05 20:01, Michael Engelhardt m...@mindcrime-ilab.de wrote: Hi, just playing around with the functional capabilities of D. One concept of the pure functional programming is that variables should not be reassigned, so the best(?) way to assure this is using immutable:

is(...) with alias this

2013-01-05 Thread Zhenya
Hi! I just read the David's post http://forum.dlang.org/thread/kc9e74$bg7$1...@digitalmars.com This code worked with dmd 2.060: import std.stdio; import std.traits; struct OhWhy(S) { S[] arr; alias arr this; } void main() { static assert(isArray!(OhWhy!(float))); }

Re: Why is immutable not possible as a result of a reduce expression?

2013-01-05 Thread monarch_dodra
On Saturday, 5 January 2013 at 20:09:24 UTC, Simen Kjaeraas wrote: The reason is that ranges may not be immutable or const. Ranges need to be mutated (popFront) to be iterable, and your filtered range cannot be mutated, by virtue of being immutable. I'm surprised that seq and filtered work,

template function. test array parameter length

2013-01-05 Thread ref2401
I have a template function that must work with an array of float values. something like this: void foo(T : A[], A)(auto ref T arg) if(is(A == float)) { ... } Array may be static or dynamic. But the length of the array must be 16 or 32. How can i test length value?

Re: is(...) with alias this

2013-01-05 Thread Philippe Sigaud
I think the alias this transformation is done 'before' any usual conversion. I guess it's a real replacement inside the code (I'm not sure how to explain my feeling). But in any case, since OhWhy!(float) type is ... OhWhy!(float), I agree this should fail.

Re: is(...) with alias this

2013-01-05 Thread monarch_dodra
On Saturday, 5 January 2013 at 22:09:45 UTC, Philippe Sigaud wrote: I think the alias this transformation is done 'before' any usual conversion. I guess it's a real replacement inside the code (I'm not sure how to explain my feeling). But in any case, since OhWhy!(float) type is ...

Re: template function. test array parameter length

2013-01-05 Thread ref2401
thanks)

Re: template function. test array parameter length

2013-01-05 Thread Philippe Sigaud
On Sat, Jan 5, 2013 at 10:50 PM, ref2401 refacto...@gmail.com wrote: I have a template function that must work with an array of float values. something like this: void foo(T : A[], A)(auto ref T arg) if(is(A == float)) { ... } Array may be static or dynamic. But the length of

Auto-Implemented properties

2013-01-05 Thread michaelc37
i was trying to make a D template to mimic auto-implemented properties in c#. I think i got it to work but when i tried to give the template a more meaning full name like AutoImplementedProperty i get a compile error a.title is not an lvalue. Is this a bug? Is there a more suitable way of doing

Re: Auto-Implemented properties

2013-01-05 Thread Philippe Sigaud
Hi Michael, your code works for me (DMD 2.061, Linux), with a semicolon after the alias in class Bar. Also, use writeln, not writefln, because writefln assumes the first parameter is the formatting string.

Re: Auto-Implemented properties

2013-01-05 Thread monarch_dodra
On Saturday, 5 January 2013 at 22:53:44 UTC, Philippe Sigaud wrote: Hi Michael, your code works for me (DMD 2.061, Linux), with a semicolon after the alias in class Bar. Also, use writeln, not writefln, because writefln assumes the first parameter is the formatting string. Why would you

Re: Auto-Implemented properties

2013-01-05 Thread michaelc37
On Saturday, 5 January 2013 at 22:53:44 UTC, Philippe Sigaud wrote: Hi Michael, your code works for me (DMD 2.061, Linux), with a semicolon after the alias in class Bar. Also, use writeln, not writefln, because writefln assumes the first parameter is the formatting string. Thanks for the

Re: Why is immutable not possible as a result of a reduce expression?

2013-01-05 Thread Ali Çehreli
On 01/05/2013 12:09 PM, Simen Kjaeraas wrote: A little details is that immutable auto is unnecessary, as immutable implies auto (the details are more complex, but that's the short version). It is true that the OP does not need auto when there is already immutable but does immutable really

Re: Auto-Implemented properties

2013-01-05 Thread Ali Çehreli
On 01/05/2013 03:25 PM, michaelc37 wrote: On Saturday, 5 January 2013 at 22:53:44 UTC, Philippe Sigaud wrote: Hi Michael, your code works for me (DMD 2.061, Linux), with a semicolon after the alias in class Bar. Also, use writeln, not writefln, because writefln assumes the first parameter is

Re: Auto-Implemented properties

2013-01-05 Thread Ali Çehreli
On 01/05/2013 04:32 PM, Ali Çehreli wrote: I confirm this: Any name other than the seemingly magical autoproperty causes the following errors: Error: a.title is not an lvalue Error: expression has no value I retract that! :) That happens when I replace only the two autoproperty with

Re: Why is immutable not possible as a result of a reduce expression?

2013-01-05 Thread Jonathan M Davis
On Saturday, January 05, 2013 16:18:51 Ali Çehreli wrote: On 01/05/2013 12:09 PM, Simen Kjaeraas wrote: A little details is that immutable auto is unnecessary, as immutable implies auto (the details are more complex, but that's the short version). It is true that the OP does not need

Re: Why is immutable not possible as a result of a reduce expression?

2013-01-05 Thread Ali Çehreli
On 01/05/2013 04:59 PM, Jonathan M Davis wrote: D's auto _is_ automatic type deduction like in C++11. It must have changed in the last couple of years. I see that the documentation is now different: http://dlang.org/attribute.html#auto It now says The auto attribute is used when there