Scalar + array operations

2014-05-21 Thread Stefan Frijters via Digitalmars-d-learn
When working on my current project (writing a numerical simulation code) I ran into the following issue when trying to multiply a vector (represented by a fixed-length array) by a scalar: import std.stdio; void main() { int ifoo = 2; int[3] ibar = 1; double dfoo = 2.0; double[3] dbar

Re: Scalar + array operations

2014-05-21 Thread bearophile via Digitalmars-d-learn
Stefan Frijters: Is this by design? It was very surprising to me, especially since all other combinations do seem to work. I don't know if this situation is by design. At first sights it seems a limitation that could be removed. Bye, bearophile

Re: Scalar + array operations

2014-05-21 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 21 May 2014 at 11:45:57 UTC, Stefan Frijters wrote: When working on my current project (writing a numerical simulation code) I ran into the following issue when trying to multiply a vector (represented by a fixed-length array) by a scalar: import std.stdio; void main() { int

Re: Scalar + array operations

2014-05-21 Thread Stefan Frijters via Digitalmars-d-learn
On Wednesday, 21 May 2014 at 13:52:47 UTC, John Colvin wrote: Please file a bug, there's no reason for that not to work, it just needs to be implemented properly. Ok, thanks for confirming. Filed as https://issues.dlang.org/show_bug.cgi?id=12780 .

Re: Scalar + array operations

2014-05-21 Thread Francesco Cattoglio via Digitalmars-d-learn
On Wednesday, 21 May 2014 at 13:52:47 UTC, John Colvin wrote: On Wednesday, 21 May 2014 at 11:45:57 UTC, Stefan Frijters wrote: I would have expected the last case to work as well, but I get testarr.d(20): Error: incompatible types for ((dfoo) * (ibar[])): 'double' and 'int[]' Is this by des

Re: Scalar + array operations

2014-05-21 Thread Stefan Frijters via Digitalmars-d-learn
On Wednesday, 21 May 2014 at 17:07:27 UTC, Francesco Cattoglio wrote: On Wednesday, 21 May 2014 at 13:52:47 UTC, John Colvin wrote: On Wednesday, 21 May 2014 at 11:45:57 UTC, Stefan Frijters wrote: I would have expected the last case to work as well, but I get testarr.d(20): Error: incompatibl

Re: std.concurrency bug?

2014-05-21 Thread Ali Çehreli via Digitalmars-d-learn
On 05/20/2014 05:24 PM, Charles Hixson via Digitalmars-d-learn wrote: > On Tuesday, May 20, 2014 11:42:48 AM Ali Çehreli via Digitalmars-d-learn > wrote: >> On 05/20/2014 11:38 AM, Charles Hixson via Digitalmars-d-learn wrote: >>> Is it a bug that an immutable struct cannot be sent to a thread?

Re: std.concurrency bug?

2014-05-21 Thread Charles Hixson via Digitalmars-d-learn
On Wednesday, May 21, 2014 01:19:32 PM Ali Çehreli via Digitalmars-d-learn wrote: > On 05/20/2014 05:24 PM, Charles Hixson via Digitalmars-d-learn wrote: > > On Tuesday, May 20, 2014 11:42:48 AM Ali Çehreli via Digitalmars-d-learn > > > > wrote: > >> On 05/20/2014 11:38 AM, Charles Hixson via

DLang Front Page Code Example

2014-05-21 Thread Nicholas Londey via Digitalmars-d-learn
I was looking at this code the other day and thought to my self "This is terrible D" in the order of the C hello world with no error handling and returning a junk stack value. I am a reasonably experienced C++ programmer but still a newbie at D. However, between the ideals of reusable code and