Exploring a little bit of language safety
Find a file
2024-01-12 10:07:34 -05:00
rust add stuff 2024-01-12 07:13:49 -05:00
README.md write 2024-01-12 10:07:34 -05:00
test.js add stuff 2024-01-12 07:13:49 -05:00
test.py add stuff 2024-01-12 07:13:49 -05:00

I read an article recently that described an attempted back door in the Linux kernel and it got me thinking about language safety.

First I tested beloved Rust:

cargo run

error[E0308]: mismatched types
 --> src/main.rs:3:8
  |
3 |     if ligma = 4 {
  |        ^^^^^^^^^ expected `bool`, found `()`
  |
help: you might have meant to compare for equality
  |
3 |     if ligma == 4 {
  |               +

For more information about this error, try `rustc --explain E0308`.
error: could not compile `linux_03_backdoor_test` (bin "linux_03_backdoor_test") due to 1 previous error

of course it threw a fit.

Next up is Python:

python test.py

   if ligma = 4:
  "   Sort sequence: [\/]$,\<core\%(\.\d\+\)\=\>,\.h$,\.c$,\.cpp$,\~\=\*$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$             │       ^^^^^^^^^
  "   Quick Help: <F1>:help  -:go up dir  D:delete  R:rename  s:sort-by  x:special                                            │SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?

Python caught it.

Next, JavaScript:

node test.js

4

This is why I hate JS.