Porting Go's io package to C

2 pointsposted 4 hours ago
by ingve

2 Comments

mitul005

4 hours ago

Go’s io package works so well because interfaces are implicit and lightweight.

In C, you can mimic the shape with function pointers, but you lose a lot of the ergonomics and safety. Curious how far you can push composability before it becomes too cumbersome to use in practice.

jjgreen

2 hours ago

A nit on the use of *: in lots of places there are "int* foo" and so on, but in C it's traditional to have "int *foo" since "int* foo, bar" looks like foo & bar are pointers, but they are not, bar is an int, while "int *foo, bar" suggests the interpretation that the compiler will make.