This. Writing a parser in Zig is so simple. Just allocate once, and then start writing your parser.
One allocator for parser, one for scanner. One for type allocation. Keep them all for semantic analysis. Write the output renderer (binary/language). Deallocate.
In this whole process, it makes it so easy to not think about memory anymore. Just enjoy writing your program.
The scanner can probably be zero allocation though - zig should be able to express an iterator over the input byte array that returns a token on dereference without needing more state than the position in the array
But I left it because of recursive imports. I had to basically put all my types into one file and use them from various others. For a relatively medium sized project (~10LOC), its a but of a hassle. Refactoring is an issue.
That being said, the language is fantastic. Can anybody with experience suggest me what HTTP library/framework do they prefer for servers?
Node really doesn't work with circular imports. There are runtime gotchas with it, for example destructuring a cyclic import via require() will give undefined for the destructured values as they "don't exist yet".
Go through Zig’s Async. Its a bit like co-routines but low level. You are required to keep track of memory allocations and pointers to function “frames”. For someone coming from a high-level language POV, frames were a new concept. But Zig does it so superb.
Zig just needs some runtime event loop like Tokio or AsyncIO from Rust to get up and running with its fantastic async model.
given that space is hard, any progress in this direction has real and practical repercussions for all of humanity; for example, knowing how to handle metals, chemicals, mechanical systems, logical systems (production chains and industrial production), lighter and more powerful computers, human biology and so on
furthermore, the fascination with space missions generates hordes of inspired children who will study and thus this plant the seeds of scientists for future generations who will solve tomorrow's problems (in practice, it is a long-term investment)
of the race to the moon we now have the practical and common use of transistors and chips, led, batteries, pace makers, medical pumps, thermal insulation and dozens of other things we use and take for granted every day
to prefer little and bad immediately at the expense of much and good in the future is a very short-sighted and stupid attitude
What makes you think India hasn't been investing in railway safety? While the recent accident was unfortunate, number of railway accidents have been decreasing over years. Here is an infographic:
One allocator for parser, one for scanner. One for type allocation. Keep them all for semantic analysis. Write the output renderer (binary/language). Deallocate.
In this whole process, it makes it so easy to not think about memory anymore. Just enjoy writing your program.