Hacker News new | ask | show | jobs
by brrrrrm 1145 days ago
I've been working on mix of ML performance and abstraction for a while and this is a breath of fresh air. Zig is truly a fascinating language, and the semantics revealed in this post are surprisingly powerful.

"By hard coding the forward and backward methods at comptime we have some more comfort with the general correctness and expected errors we would receive if we passed in incorrectly shaped data at runtime."

This solves the issues of shape checking incredibly cleanly. Python libraries have been struggling with this for a decade. It seems like you could also extending comptime usage to also calculate allocations ahead of time.

Honestly, this whole thing makes me want to invest quite a bit of time into using Zig. Great post!

1 comments

What does this offer that basic dependent typing doesn't?
nothing really, that's effectively what's achieved by comptime.

it's funny to see it written as "basic" dependent typing, considering it's an extremely complex type system to implement.