this(T...) not called in struct constructor

2013-09-17 Thread Timothee Cour
This may have been discussed before, but I'm not sure whether this is a bug or not. In any case it's a bit confusing. struct Foo2{ this(T...)(T args){ assert(0); } } void main(){ auto a2=Foo2();//doesn't call assert(0) (ie this(T...) not called) }

Re: I cannot understand problem with argument of the function

2013-09-17 Thread mrd
(question is not about function body realisation - body just don't receives right argument value)

I cannot understand problem with argument of the function

2013-09-17 Thread mrd
// Simple function called for unsigned integers: static ubyte[] packVarint(T)( T value ) if( isIntegral!T && isUnsigned!T ) out( arr ) { T d; size_t size = d.unpackVarint( &arr[0] ); import std.stdio; import std.conv; writeln( "out contract, type=", typeid(T), " isUnsigned=",

Re: Compile time data structure

2013-09-17 Thread H. S. Teoh
On Wed, Sep 18, 2013 at 04:12:01AM +0200, John Colvin wrote: > On Wednesday, 18 September 2013 at 01:24:37 UTC, Ali Çehreli wrote: > >As far as I know, static foreach is only for tuples (or TypeTuples) > > TypeTuples are tuples. Sortof. We really need to get that whole > situation sorted Not

Re: Compile time data structure

2013-09-17 Thread John Colvin
On Wednesday, 18 September 2013 at 01:24:37 UTC, Ali Çehreli wrote: As far as I know, static foreach is only for tuples (or TypeTuples) TypeTuples are tuples. Sortof. We really need to get that whole situation sorted

Re: Compile time data structure

2013-09-17 Thread Ali Çehreli
On 09/16/2013 01:24 PM, Marek Janukowicz wrote: >static string[string] columns () { // ... >} Although the function itself is static, it returns a dynamic value. > foreach( attr, col; columns() ) { >__traits(getMember, me, attr) = typeof(__traits(getMember, me, > attr)).ini

Re: Windows DLLs with D

2013-09-17 Thread Rainer Schuetze
On 14.09.2013 18:46, Buk wrote: Hi all, I've read http://dlang.org/dll.html, and frankly there seems to be a lot of boilerplate & rote process to build a DLL. I realise that many of the do nothing functions /can/ be used to do a lot more; and these may be required for some purposes. But, for

Re: GC.collect bug ?

2013-09-17 Thread Sean Kelly
On Sep 17, 2013, at 4:14 AM, Temtaime wrote: > I cannot use the delete/destroy. I want to call dtor at all unreferenced > objects. > Manual from Dlang size says that GC.collect triggers a full collection. But > it doesn't. It does. But the collector isn't guaranteed to collect everything that

Re: Windows DLLs with D

2013-09-17 Thread Dicebot
On Tuesday, 17 September 2013 at 16:05:13 UTC, Buk wrote: Thanks for the help guys. Sorry for the silence. It has just happened that your question touches relatively under-explored area of the language and thus finding someone with actual experience on topic is hard. I don't even know if we

Re: Windows DLLs with D

2013-09-17 Thread Buk
On Saturday, 14 September 2013 at 16:46:06 UTC, Buk wrote: Hi all, I've read http://dlang.org/dll.html, and frankly there seems to be a lot of boilerplate & rote process to build a DLL. I realise that many of the do nothing functions /can/ be used to do a lot more; and these may be required

Re: License of RosettaCode examples (for bearophile:-)

2013-09-17 Thread bearophile
Joseph Rushton Wakeling: Well, I guess the best thing would be just to write here, "I license the code under the terms of the Boost license" or something similar (public domain is in some ways less good because not every jurisdiction recognizes it, but as far as I'm concerned it's fine too).

Re: License of RosettaCode examples (for bearophile:-)

2013-09-17 Thread Joseph Rushton Wakeling
On 17/09/13 15:18, bearophile wrote: Joseph Rushton Wakeling: I have a specific interest in your circular queue implementation: http://rosettacode.org/wiki/Queue/Usage#Faster_Version If you restrict your desires to just one D program, instead of the about one thousand of Rosettacode the situa

Re: License of RosettaCode examples (for bearophile:-)

2013-09-17 Thread bearophile
Joseph Rushton Wakeling: I have a specific interest in your circular queue implementation: http://rosettacode.org/wiki/Queue/Usage#Faster_Version If you restrict your desires to just one D program, instead of the about one thousand of Rosettacode the situation becomes _much_ simpler :-) I wr

Re: License of RosettaCode examples (for bearophile:-)

2013-09-17 Thread Joseph Rushton Wakeling
On 17/09/13 14:03, bearophile wrote: I am writing code for Rosettacode since years, I have written, rewritten, I have modified code written by others, and so on. I have also written many entries before having an account in that site, so there's no proof the author is me. I have also written many

Re: License of RosettaCode examples (for bearophile:-)

2013-09-17 Thread bearophile
Joseph Rushton Wakeling: Would you be prepared to license your own examples under Boost? I don't know what your intentions were for others' use of your code, but as it stands the FDL license makes them impossible to re-use. I am writing code for Rosettacode since years, I have written, rew

Re: License of RosettaCode examples (for bearophile:-)

2013-09-17 Thread Joseph Rushton Wakeling
On 17/09/13 13:32, bearophile wrote: I am just following the common licensing you see in that site: http://www.gnu.org/licenses/fdl-1.2.html Recently the author of most of the PicoLisp entries has collected them in a commercial book, this has caused some troubles. If you want info about Rosetta

Re: License of RosettaCode examples (for bearophile:-)

2013-09-17 Thread Joseph Rushton Wakeling
On 17/09/13 13:17, Iain Buclaw wrote: An example of what the situation is using GNU FDL - last time I checked material under the GNU FDL could not be put into GPL code and GPL code could not be put into a GNU FDL manual. So watch out! :-) Indeed. An unfortunate situation, no?

Re: User defined attributes use

2013-09-17 Thread Artur Skawina
On 09/17/13 00:53, H. S. Teoh wrote: > On Mon, Sep 16, 2013 at 10:59:10PM +0200, Artur Skawina wrote: >> On 09/16/13 22:38, Namespace wrote: [1] Obviously, not a practical short term option for the existing D2 language. That's probably clear from the context, and the questio

Re: N step fft in D language

2013-09-17 Thread kraybit
On Sunday, 15 September 2013 at 20:58:54 UTC, Kadir Erdem Demir wrote: On Sunday, 15 September 2013 at 15:39:14 UTC, John Colvin wrote: On Sunday, 15 September 2013 at 15:15:28 UTC, Kadir Erdem Demir wrote: I am using fft function from std.numeric Complex!double[] resultfft = fft(timeDomainAmp

Re: License of RosettaCode examples (for bearophile:-)

2013-09-17 Thread bearophile
Joseph Rushton Wakeling: This message is especially for bearophile, but applies to anyone posting examples on RosettaCode :-) Can I ask you to clarify your licensing intentions for these examples? By default all on RosettaCode is GNU Free Documentation License, which does not really play in

Re: public alias to private template implementation

2013-09-17 Thread Dicebot
That is actually very weird because you can override protection attribute with alias for an aggregate: // b.d private struct A_ { } public alias A = A_; // a.d void main() { A a; } // fine! That inconsistency feels plain wrong. Worth enhancement request at least.

Re: License of RosettaCode examples (for bearophile:-)

2013-09-17 Thread Iain Buclaw
On Tuesday, 17 September 2013 at 11:04:13 UTC, Joseph Rushton Wakeling wrote: This message is especially for bearophile, but applies to anyone posting examples on RosettaCode :-) Can I ask you to clarify your licensing intentions for these examples? By default all on RosettaCode is GNU Free

Re: GC.collect bug ?

2013-09-17 Thread Temtaime
I cannot use the delete/destroy. I want to call dtor at all unreferenced objects. Manual from Dlang size says that GC.collect triggers a full collection. But it doesn't.

License of RosettaCode examples (for bearophile:-)

2013-09-17 Thread Joseph Rushton Wakeling
This message is especially for bearophile, but applies to anyone posting examples on RosettaCode :-) Can I ask you to clarify your licensing intentions for these examples? By default all on RosettaCode is GNU Free Documentation License, which does not really play in a friendly way with ... ju

Re: public alias to private template implementation

2013-09-17 Thread Joseph Rushton Wakeling
On 17/09/13 11:30, monarch_dodra wrote: Thanks. I'm not very fluent with opDispatch though. Doesn't that only work if you have an struct/class instance though? My "fun" is a free frunction. Ack. Sorry, I overlooked that. :-( Still, I think this provides greater impulse for Issue 10996 to be f

Re: public alias to private template implementation

2013-09-17 Thread monarch_dodra
On Tuesday, 17 September 2013 at 08:47:25 UTC, Joseph Rushton Wakeling wrote: On 16/09/13 23:00, monarch_dodra wrote: Question 1: Is this the correct behavior? I'd have expected that if my alias is public, it would allow any one from outside to make the call correctly. See: http://d.puremagic

Re: public alias to private template implementation

2013-09-17 Thread Joseph Rushton Wakeling
On 16/09/13 23:00, monarch_dodra wrote: Question 1: Is this the correct behavior? I'd have expected that if my alias is public, it would allow any one from outside to make the call correctly. See: http://d.puremagic.com/issues/show_bug.cgi?id=10996 Question 2: Is there a "correct" way to do t

Re: How to compile this template with short type?

2013-09-17 Thread mrd
ahhh, many thanks! I need more sleep

Re: How to compile this template with short type?

2013-09-17 Thread Namespace
On Tuesday, 17 September 2013 at 07:58:40 UTC, mrd wrote: [code] Unsigned!T encodeZigZag( T )( inout T v ) pure if( isSigned!( T ) ) { return v > 0 ? v * 2 : -v * 2 - 1; } unittest { assert( encodeZigZag!long( 2147483647 ) == 4294967294 );

How to compile this template with short type?

2013-09-17 Thread mrd
[code] Unsigned!T encodeZigZag( T )( inout T v ) pure if( isSigned!( T ) ) { return v > 0 ? v * 2 : -v * 2 - 1; } unittest { assert( encodeZigZag!long( 2147483647 ) == 4294967294 ); assert( encodeZigZag!long( -2147483648 ) == 4294967295 );