the.bay.news

Compiler-checked runtime interfaces with struct(interface) syntax

Ziggit
Compiler-checked runtime interfaces with struct(interface) syntax
Zig std often uses a pattern of building a vtable to represent an interface at runtime. This is used for things like std.Io for example. The main problem with building an interface structure by hand is that: It is a bit verbose to implement a vtable in a structure with correct logic from memory. Handwritten interface implementations are not checked to adhere to the interface surface. In Zig there already exist similar syntax to collection that give a contract for user. The enum and union k...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.