On Wednesday, 5 May 2021 at 09:28:45 UTC, Imperatorn wrote:
> On Wednesday, 5 May 2021 at 09:18:58 UTC, Imperatorn wrote:
> On Wednesday, 5 May 2021 at 08:58:41 UTC, user1234 wrote:
> On Saturday, 1 May 2021 at 11:32:47 UTC, Blatnik wrote:
> I love how D redesigned the terrible C/C++ arrays. And it's awesome that array operations like element wise +, -, etc. are built into the language - it makes me want to use arrays and slices for everything. But there are still some rough edges in the design.
I have experimented some and found a few workarounds which might be acceptable.
But, I'm having some weird bug. On dmd and dmd-beta it works,
This all works with 2.096.0 and beta but not nightly
import std.stdio;
immutable ic = [1, 2, 3] + [3, 2, 1];
const ca2 = [1, 2, 3] + [3, 2, 1];
enum ea2 = [1, 2, 3] + [3, 2, 1];
int[] i3 = [1, 2, 3] + [3, 2, 1];
auto a6 = [1, 2, 3] + [3, 2, 1];
void main()
{
pragma(msg, __VERSION__);
auto a = [1, 2, 3];
auto b = [3, 2, 1];
enum ia2 = [1, 2, 3] + [3, 2, 1] + [1, 1, 1];
int[3] d;
d = a[] + b[];
writeln(ia2);
writeln(ic);
writeln(ca2);
writeln(ea2);
writeln(a6);
writeln(d);
}