It's called unsafe because it's a property of the scope; not a function.

`unsafe {}` in Rust is **not** a contract by the developer, it's a checkbox 
that disable a few compiler checks that would otherwise make some necessary low 
level operation impossible.

It's not the developer telling other developer "hey this is safe to use", it's 
the developer telling the compiler "hey I want to do some unsafe thing here, 
don't bother me". It's cultural that the Rust community expects developer to 
make sure the code wrote in unsafe block is actually safe / sanitized - 
rightfully or not, everyone is free to have their own opinion.

While restricting the code you can write at the compiler level is tempting for 
improving safety, I don't think that it's has ever been really successful 
regarding adoption (Ada being a prime example of that).

On the other side of the spectrum Javascript and Python have great adoption to 
the point that their respective VM are now being ported to microcontroller 
(look up Micropython, Zerynth and Jerryscript for more info). I'd say adoption 
trumps safety for programming language.

Making it harder to write code is not a successful model for a multi-purpose 
language if increasing adoption is your goal.

On the other hand, using tag / effects to track unsafe calls (much like 
`thread` and `sideEffect`) and leaving the developer free to specifically 
forbid or enable said effects seems like a much better solution. But that means 
it's probably not gonna be some sort of unsafe block but something closer to a 
flag / pragma applied to an entire proc.

Reply via email to