Global Feed Post Login
Replying to Avatar ᴛʜᴇ ᴅᴇᴀᴛʜ ᴏꜰ ᴍʟᴇᴋᴜ

yep, goroutines and channels being first class and the functions as values are the three features that make me addicted to go, it's a whole different way of thinking

almost no other languages have coroutines at all and none have it as a low level syntax, maybe you could do it with operator overloading in C++ but that shit is messed up

unfortunately the GC and CSP kinda go hand in hand but in actual fact you can turn off the GC and you can write code to manage memory manually, in fact many network handlers in Go are written with allocate-once freelists, and you can actually do this for a whole application

as it is, i personally avoid using the compact declaration asignment operator for things, as many people use them inside if and for blocks without thinking about whether it makes sense to allocate yet another value on the stack when there already is one with the same name, and scope shadowing can hide some bad bugs

72
nobody 1y ago

I’ll look into GC’less golang tomorrow. You’ve given me an interesting rabbit hole to go down…

Reply to this note

Please Login to reply.

Discussion

Avatar
ᴛʜᴇ ᴅᴇᴀᴛʜ ᴏꜰ ᴍʟᴇᴋᴜ 1y ago

yeah, there is a variant also, tinygo https://tinygo.org/ which supports almost everything in go except for GC, main point is it will let you use coroutines, even on one core you can use coroutines, they are possible to use that way (with channels as well of course)

Thread collapsed