Hacker News new | ask | show | jobs
by Gigachad 1089 days ago
Does Nim make you explicitly enter an unsafe mode to access raw pointers?
2 comments

What that even means? Just random words. unsafe block is just an illusion and doesn't prevent any bugs. Don't get me started on the cult that shames repos that use it.
Sure, but upon review it was found some of the code was using unsafe without reason, and people submitted pull requests which made the code better. It's better because you are sure it doesn't have a memory unsafety bug, even if the code "looked" right before.
Given how Actix was used for benchmarking, I'd imagine that there was a reason the original developer wanted to use unsafe a lot. Nginx was written in pure C, and that is an act of wizardry. I can't imagine wanting to do any work for a language with a 'community' full of people eager to flame or do worse things to developers who don't meet their pompous definition of safety.
No, what's the point of that? It's not hard to recognize unsafe code.
You can't grep for it, but you can grep `unsafe`
`ptr`, `addr` and `cast` are the only ways to introduce unsafety, as I understand it. You have to run three greps, but you can definitely grep.
`grep -w 'pointer|ptr|addr|cast'` would do it in one.. (One can surely do a shell alias called `find-unsafe`..).

Finding unsafe constructs in Nim code is not that hard, at least at the same level of accuracy as `grep unsafe *.rs` (e.g. inside comments & strings, etc.).

To evaluate the power of this general line of argument, consider -- if Nim shipped with a `find-unsafe` source-level search utility, how much would this change your mind?

The advantages of a language that uses words rather than random punctuation.