
Zig Programming Language Blurs the Line Between Compile-Time and Run-Time - AndyKelley
http://andrewkelley.me/post/zig-programming-language-blurs-line-compile-time-run-time.html
======
FrancoDiaz
I'm the last person to talk about type theory, but on the max function
example:

 _fn max(comptime T: type, a: T, b: T) - > T { if (a > b) a else b } fn
letsTryToPassARuntimeType(condition: bool) { const result = max( if
(condition) f32 else u64, 1234, 5678); } Then we get this result from the
compiler:

./test.zig:6:9: error: unable to evaluate constant expression if (condition)
f32 else u64, ^_

Couldn't the compiler infer some kind of union type. You don't know the type
at runtime, but f32 or u64 is a legit comparision type.

------
FrancoDiaz
I like what I'm seeing, but a suggesting regarding shortened keywords. Just go
ahead and change compTime to compileTime. I don't see 3 extra characters
saving much and makes it less readable. Most modern editors will autocomplete
anyway.

