Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>for example it's true you can write a C-style for loop in C#, but you almost never should, C# has a (not great, but it's something) for-each loop that's idiomatic.

This makes the learning curve way easier. You can start meaningfully using C# while using C-style for loops, and eventually switch to 'foreach' once you realize it's better.

If I wanted to give Zig a try today by using it for some small low-priority task, I would keep stumbling on these minor syntax differences all the time, and would eventually give up and do it in C/C++ because the overhead outweighs my curiosity.

Most pragmatists don't have infinite time to learn a new programming language for fun. They have a very limited amount of attention and tight time constraints, and will move to the next pragmatic solution if it starts looking like the current one is not cutting it.



> I would keep stumbling on these minor syntax differences all the time, and would eventually give up

I can't necessarily fault Zig for the state of this so early in its lifetime, but - that should not be a big problem, handling transition is work for the diagnostics.

Suppose I write this in Rust: printf("%d", count);

Rust says it can't find a function named printf, but it suggests perhaps I want the print! macro instead?

OK, let's try again: print!("%d", count);

No, says Rust, % style format strings aren't a thing in Rust, use {curly brackets}

Sure enough: print!("{count}"); // compiles and works.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: