D vs nim

Andrew Kelley superjoe30 at gmail.com
Tue May 8 17:59:41 UTC 2018


On Thursday, 3 May 2018 at 19:11:05 UTC, Mark wrote:
> On Wednesday, 25 April 2018 at 14:18:07 UTC, Rel wrote:
>> In case you guys like to take a quick look at new emerging,
>> but somewhat unknown systems programming languages:
>> * https://www.red-lang.org/ (own handwritten backend)
>> * https://crystal-lang.org/ (llvm-based backend)
>> * https://ziglang.org/ (llvm-based backend)
>> * http://nitlanguage.org/ (c-based backend?)
>> * https://www.xojo.com/ (llvm-based backend)
>
> Funnily, none of these languages have a "static if" construct, 
> nor do Rust, Swift and Nim. Not one that I could find, anyway.

Zig has implicit static if:

test "static if" {
     if (false) {
         @compileError("this is never analyzed");
     }
}

$ zig test test.zig
Test 1/1 static if...OK

test "static if" {
     if (true) {
         @compileError("this is analyzed");
     }
}

$ zig test test.zig
test.zig:3:9: error: this is analyzed
         @compileError("this is analyzed");
         ^



More information about the Digitalmars-d mailing list