Re: indexing a tuple containing a struct strange result

2013-06-24 Thread cal
On Monday, 24 June 2013 at 05:31:29 UTC, Ali Çehreli wrote: On 06/23/2013 10:07 PM, Ali Çehreli wrote: I think it is a compiler bug. Make that a Phobos bug. :) The following is a reduced program that exhibits the problem. The presence or absence of the unused member function makes a

QTD on Ubuntu

2013-06-24 Thread Chris
Hi, I am having problems compiling qtd on Ubuntu 12.04. QtD needs Qt4, however I also have Qt5 installed. By default cmake grabs version 5 which of course produces error messages. In case anyone knows a quick fix (cmake flag, or a qmake flag etc.) please let me know. Thanks a million!

eof

2013-06-24 Thread lx
Hi,everyone, I am learning D.I installed a plugin-visusl D to visual studio 2008.I am very confused that ctrl+z didn't teminate the input of console,it result in a dead loop.When reading from a txt file,a extra line will be read and usually it result in a wrong result.Is there anyone who has

Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

2013-06-24 Thread David
I am getting lots of errors when compiling with -w: // https://github.com/Dav1dde/gl3n/blob/master/gl3n/linalg.d#L144 this(T)(T vec) if(is_vector!T is(T.vt : vt) (T.dimension = dimension)) { vector = vec.vector[0..dimension]; } this line produces following warning:

Trouble with lockstep

2013-06-24 Thread Craig Dillabaugh
Hello, I have code which generates a histogram from an array and prints out the histogram bins/counts. However I cannot get the code to iterate and print out the histogram to work. The following is a minimal example: import std.range; import std.stdio; void main() { ubyte[] data =

Re: Trouble with lockstep

2013-06-24 Thread Joseph Rushton Wakeling
On 06/24/2013 03:05 PM, Craig Dillabaugh wrote: Can anyone identify what I am doing wrong. Also I am curious to know why std.range includes both Lockstep and lockstep - they seem like the same thing. lockstep is a helper function that returns an instance of Lockstep. The reason is that if

Re: QTD on Ubuntu

2013-06-24 Thread Jonathan M Davis
On Monday, June 24, 2013 12:04:51 Chris wrote: Hi, I am having problems compiling qtd on Ubuntu 12.04. QtD needs Qt4, however I also have Qt5 installed. By default cmake grabs version 5 which of course produces error messages. In case anyone knows a quick fix (cmake flag, or a qmake flag

Re: Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

2013-06-24 Thread Jonathan M Davis
On Monday, June 24, 2013 16:07:19 David wrote: I am getting lots of errors when compiling with -w: // https://github.com/Dav1dde/gl3n/blob/master/gl3n/linalg.d#L144 this(T)(T vec) if(is_vector!T is(T.vt : vt) (T.dimension = dimension)) { vector = vec.vector[0..dimension];

Re: Trouble with lockstep

2013-06-24 Thread David
lockstep(iota!ubyte(ubyte.min, ubyte.max), bins[]) Works, but this leaves you with other errors, I couldn't find a solution for. Something seems to be wrong with opApply of lockstep. Or maybe I miss something obvious...

Re: eof

2013-06-24 Thread bearophile
lx: I am very confused that ctrl+z didn't teminate the input of console,it result in a dead loop. I think this is a library bug, I noticed it some times, but I didn't file it. Maybe it's worth filing in Bugzilla. When reading from a txt file,a extra line will be read and usually it

Re: Trouble with lockstep

2013-06-24 Thread Craig Dillabaugh
On Monday, 24 June 2013 at 14:15:55 UTC, Joseph Rushton Wakeling wrote: On 06/24/2013 03:05 PM, Craig Dillabaugh wrote: Can anyone identify what I am doing wrong. Also I am curious to know why std.range includes both Lockstep and lockstep - they seem like the same thing. lockstep is a

Re: Trouble with lockstep

2013-06-24 Thread bearophile
Craig Dillabaugh: foreach( idx, count; lockstep( iota!ubyte(ubyte.min, ubyte.max), bins ) ) Also note that doesn't iterate the whole ubyte range. Maybe we need another iota range for that, with a different name or with an optional template argument string like [] as std.random.uniform.

Re: Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

2013-06-24 Thread bearophile
David: Why does dmd produce this warning? (this is new in 2.063) Why is assigning elementwise better? The short answer is: do as the compiler suggests you, and be very happy the compiler avoids you some bugs. The explanation is longer. In brief, it's much better to avoid some bugs and to

Re: Trouble with lockstep

2013-06-24 Thread Craig Dillabaugh
On Monday, 24 June 2013 at 14:33:48 UTC, bearophile wrote: Craig Dillabaugh: foreach( idx, count; lockstep( iota!ubyte(ubyte.min, ubyte.max), bins ) ) Also note that doesn't iterate the whole ubyte range. Maybe we need another iota range for that, with a different name or with an

Re: QTD on Ubuntu

2013-06-24 Thread Chris
On Monday, 24 June 2013 at 14:18:52 UTC, Jonathan M Davis wrote: On Monday, June 24, 2013 12:04:51 Chris wrote: Hi, I am having problems compiling qtd on Ubuntu 12.04. QtD needs Qt4, however I also have Qt5 installed. By default cmake grabs version 5 which of course produces error messages. In

Re: Trouble with lockstep

2013-06-24 Thread bearophile
David: Something seems to be wrong with opApply of lockstep. Or maybe I miss something obvious... I have suggested to remove lockstep from Phobos: http://d.puremagic.com/issues/show_bug.cgi?id=8155 Why don't you try to use std.range.zip? Bye, bearophile

Re: Trouble with lockstep

2013-06-24 Thread Craig Dillabaugh
On Monday, 24 June 2013 at 14:56:41 UTC, bearophile wrote: David: Something seems to be wrong with opApply of lockstep. Or maybe I miss something obvious... I have suggested to remove lockstep from Phobos: http://d.puremagic.com/issues/show_bug.cgi?id=8155 Why don't you try to use

Re: Trouble with lockstep

2013-06-24 Thread bearophile
Craig Dillabaugh: I now get the error (which seems to be the same problem I had before - see the last error): ... /usr/include/dmd/phobos/std/range.d(4451): Error: template std.range.zip cannot deduce template function from argument types !()(Result, uint[256LU]) Most range/algorithm

Re: Trouble with lockstep

2013-06-24 Thread Joseph Rushton Wakeling
On 06/24/2013 03:05 PM, Craig Dillabaugh wrote: I get the following error messages which I cannot decipher. Oddly enough, I'm also getting lockstep-related error messages at compile-time: /opt/gdc/include/d/4.8.1/std/range.d:4716: Error: delegate dg (ref double, ref ulong) is not callable using

Re: Trouble with lockstep

2013-06-24 Thread Craig Dillabaugh
On Monday, 24 June 2013 at 15:15:46 UTC, bearophile wrote: Craig Dillabaugh: clip Most range/algorithm functions unfortunately don't accept a fixes size array. So you have to slice it: void main() { import std.stdio, std.range; ubyte[] data = [17, 32, 32, 32, 38, 39, 39, 47,

Re: InstanceOf

2013-06-24 Thread Steven Schveighoffer
On Sun, 23 Jun 2013 11:29:10 -0400, Lemonfiend le...@fie.nd wrote: On Sunday, 23 June 2013 at 15:15:16 UTC, Jacob Carlborg wrote: On 2013-06-23 13:26, Lemonfiend wrote: foreach (I i; array) { if (B b = cast(B) i) { ... } } Thanks all 3 of you for the quick and identical answers. :) It

Re: Can call static method with null reference

2013-06-24 Thread Steven Schveighoffer
On Sun, 23 Jun 2013 06:09:19 -0400, Jonathan M Davis jmdavisp...@gmx.com wrote: On Sunday, June 23, 2013 12:02:42 Namespace wrote: Also I don't know why I should call static methods from an instance. What's the purpose? It's stupid and pointless as far as I can tell, but I believe that

Re: Trouble with lockstep

2013-06-24 Thread Craig Dillabaugh
On Monday, 24 June 2013 at 15:29:21 UTC, Joseph Rushton Wakeling wrote: On 06/24/2013 03:05 PM, Craig Dillabaugh wrote: I get the following error messages which I cannot decipher. Oddly enough, I'm also getting lockstep-related error messages at compile-time:

Re: Trouble with lockstep

2013-06-24 Thread Ali Çehreli
On 06/24/2013 07:05 AM, Craig Dillabaugh wrote: The following is a minimal example: Further reduced: import std.range; void main() { lockstep(iota(0, 10), [ 1 ]); } Strangely, the error message points at two comment lines in my installation of 2.063:

Re: indexing a tuple containing a struct strange result

2013-06-24 Thread Ali Çehreli
On 06/23/2013 11:11 PM, cal wrote: I'll file it now. Thanks! Thanks for filing: http://d.puremagic.com/issues/show_bug.cgi?id=10458 Ali

Re: Can call static method with null reference

2013-06-24 Thread Jesse Phillips
On Sunday, 23 June 2013 at 10:09:39 UTC, Jonathan M Davis wrote: Also I don't know why I should call static methods from an instance. What's the purpose? It's stupid and pointless as far as I can tell, but I believe that C++, Java, C#, and D all do it, so as stupid as it is, it's a common

Re: Trouble with lockstep

2013-06-24 Thread Craig Dillabaugh
On Monday, 24 June 2013 at 16:03:17 UTC, Ali Çehreli wrote: On 06/24/2013 07:05 AM, Craig Dillabaugh wrote: The following is a minimal example: Further reduced: import std.range; void main() { lockstep(iota(0, 10), [ 1 ]); } Strangely, the error message points at two comment lines in

Re: Problems building docs

2013-06-24 Thread H. S. Teoh
On Sat, Jun 22, 2013 at 08:11:25PM +0100, Joseph Rushton Wakeling wrote: Hello all, I'm having problems building the docs. I've got the latest d-programming-language.org checked out, and have tried to build with make -f posix.mak. The basic html part builds fine, but it falls over when

Re: Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

2013-06-24 Thread David
Am 24.06.2013 16:30, schrieb bearophile: David: Why does dmd produce this warning? (this is new in 2.063) Why is assigning elementwise better? The short answer is: do as the compiler suggests you, and be very happy the compiler avoids you some bugs. The problem is, I wrote this code on

Re: std.process: how to process stdout chunk by chunk without waiting for process termination

2013-06-24 Thread Kevin Lamonte
Timothee Cour wrote: On Tue, Jun 18, 2013 at 3:00 PM, Steven Schveighoffer schvei...@yahoo.comwrote: On Tue, 18 Jun 2013 17:41:57 -0400, Timothee Cour thelastmamm...@gmail.com wrote: I'd like to do the following: auto pipes = pipeShell(command, Redirect.stdout | Redirect.stderr);

Re: InstanceOf

2013-06-24 Thread Lemonfiend
On Monday, 24 June 2013 at 15:46:05 UTC, Steven Schveighoffer wrote: On Sun, 23 Jun 2013 11:29:10 -0400, Lemonfiend le...@fie.nd wrote: On Sunday, 23 June 2013 at 15:15:16 UTC, Jacob Carlborg wrote: On 2013-06-23 13:26, Lemonfiend wrote: foreach (I i; array) { if (B b = cast(B) i) { ... }

Re: Can call static method with null reference

2013-06-24 Thread Jonathan M Davis
On Monday, June 24, 2013 11:51:52 Steven Schveighoffer wrote: My suggestion to fix this has always been: only allow static calls on instance variables via opt-in. e.g.: class InfiniteRange { static bool empty() { return false; } alias InfiniteRange.empty this.empty; // just an example }

Re: Can call static method with null reference

2013-06-24 Thread Jonathan M Davis
On Monday, June 24, 2013 19:13:45 Jesse Phillips wrote: On Sunday, 23 June 2013 at 10:09:39 UTC, Jonathan M Davis wrote: Also I don't know why I should call static methods from an instance. What's the purpose? It's stupid and pointless as far as I can tell, but I believe that C++,

Possble bug ? Adding

2013-06-24 Thread Temtaime
Hello, guys ! http://dpaste.1azy.net/8917c253 Thanks. Regards.

Re: Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

2013-06-24 Thread bearophile
David: What kind of bugs does it avoid? I can't think of a single bug which could happen... (Ranges/Lengths are checked at runtime...) Some reasons: - Syntax uniformity: similar behaviours should look similar. This is a general rule of language design, that avoids troubles you don't even

Re: Trouble with lockstep

2013-06-24 Thread bearophile
Craig Dillabaugh: Also note that doesn't iterate the whole ubyte range. Maybe we need another iota range for that, with a different name or with an optional template argument string like [] as std.random.uniform. Opinions welcome. Bye, bearophile Opps. Of course. The optional template

Re: Possble bug ? Adding

2013-06-24 Thread Simen Kjaeraas
On 2013-06-24, 22:30, Temtaime wrote: Hello, guys ! http://dpaste.1azy.net/8917c253 I'm not sure I've seen this bug before, but yes, it is one. The cause is that the grammar for the new alias syntax is apparently not complete. Please file: http://d.puremagic.com/issues/enter_bug.cgi --

Re: eof

2013-06-24 Thread bearophile
I am very confused that ctrl+z didn't teminate the input of console,it result in a dead loop. I think this is a library bug, I noticed it some times, but I didn't file it. Maybe it's worth filing in Bugzilla. I have added this bug report, is this the issue you are seeing/having?

Re: Trouble with lockstep

2013-06-24 Thread Ali Çehreli
On 06/24/2013 11:01 AM, Craig Dillabaugh wrote: So is this worthy of a bug report then? Yes, please. Ali

Re: Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

2013-06-24 Thread Ali Çehreli
On 06/24/2013 12:17 PM, David wrote: The problem is, I wrote this code on purpose and I *want* it to work like that, and I evenn need it to work like that (a few lines above in construct), but this currently blocks gl3n from beeing updated for Fedora. You are right because 'vector' is a

Re: eof

2013-06-24 Thread monarch_dodra
On Monday, 24 June 2013 at 21:13:31 UTC, bearophile wrote: I am very confused that ctrl+z didn't teminate the input of console,it result in a dead loop. I think this is a library bug, I noticed it some times, but I didn't file it. Maybe it's worth filing in Bugzilla. I have added this bug

Re: Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

2013-06-24 Thread bearophile
Ali Çehreli: So, the following two have the same effect: vector = vec.vector[0..dimension]; vector[] = vec.vector[0..dimension]; The first syntax will be deprecated and later it will become an error. Bye, bearophile

Re: eof

2013-06-24 Thread bearophile
monarch_dodra: I don't think this is a bug I see. Then lx will have to explain the problem better. (I replied on the bug report): I have given an answer, comparing to Python. I think the current Phobos behavour is bad. Bye, bearophile

Re: Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

2013-06-24 Thread Ali Çehreli
On 06/24/2013 03:12 PM, bearophile wrote: Ali Çehreli: So, the following two have the same effect: vector = vec.vector[0..dimension]; vector[] = vec.vector[0..dimension]; The first syntax will be deprecated and later it will become an error. I am confused. Even if the

Re: Trouble with lockstep

2013-06-24 Thread Andrej Mitrovic
On 6/24/13, Ali Çehreli acehr...@yahoo.com wrote: Strangely, the error message points at two comment lines in my installation of 2.063: It's a regression which I've caused. I've made a fixup pull: http://d.puremagic.com/issues/show_bug.cgi?id=10468 I'm very sorry for this mishap.

Re: Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

2013-06-24 Thread bearophile
Ali Çehreli: I am confused. Even if the right-hand expression were a fixed-length array? If so, then we wouldn't speak of their being value types. (?) a = b;// should be fine Otherwise, fixed-length arrays would become weird types that cannot be used in assignment operations. I

Re: Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

2013-06-24 Thread Ali Çehreli
On 06/24/2013 04:11 PM, bearophile wrote: Currently this code gives no warnings: void main() { int[3] a, b; a = b; } This topic is discussed a little in Issue 7444. http://d.puremagic.com/issues/show_bug.cgi?id=7444#c3 Summary: 1) Single element on the right-hand side is

Re: Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

2013-06-24 Thread Ali Çehreli
On 06/24/2013 05:16 PM, Ali Çehreli wrote: 2) Mixing static array and dynamic array on both sides of = is disallowed: da[] = sa[]; // ditto da = sa[]; // ditto And I didn't mean that those two have the same meaning. The former is copy all elements, and the latter is refer to

typeof map

2013-06-24 Thread cal
Is it by design that the code below does not compile? import std.algorithm, std.range; void main() { typeof(iota(10).map!(a=a)) x = iota(10).map!(a=a); } Error message (DMD git-latest on DPaste): Error: constructor f755.main.MapResult!(__lambda2, Result).MapResult.this (Result input) is

Re: typeof map

2013-06-24 Thread Timothee Cour
I think it's because each lambda litteral is treated unique. can dmd be changed to recognize identical lambda litterals as identical? Is there any particular issue making that difficult? it already recognizes identical string literals as identical On Mon, Jun 24, 2013 at 7:45 PM, cal

Re: typeof map

2013-06-24 Thread H. S. Teoh
On Tue, Jun 25, 2013 at 04:45:33AM +0200, cal wrote: Is it by design that the code below does not compile? import std.algorithm, std.range; void main() { typeof(iota(10).map!(a=a)) x = iota(10).map!(a=a); } [...] The workaround is to use 'auto', then alias its type: