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

SeaORM and similar crates in Rust will catch some common SQL bugs through the type system.


Typescript also has ORMs.

The problem is not with TypeScript or even JavaScript but an odd Browser API where mutating some random value of an object results in a redirect on the page, but not synchronously.

Even if the language of the browser were Rust, there's nothing about the type system specifically that would have caught this bug (as far as I can tell, anyways. Presumably there's something in the background periodically reading the value of `href` and updating the page accordingly, but since that background job only would have needed read and not write access to the variable, I don't think the borrow checker would have helped here)


> Setting the value of href navigates to the provided URL [0]

It would have been caught because this API (setters) is impossible with Rust. At best, you'd have a .set_href(String).await, which would stop the thread until the location has been updated and therefore the value stabilized. At worst, you'd have a public .href variable, but because the setter pattern is impossible, you know there must be some process checking and scheduling updates.

[0]: https://developer.mozilla.org/en-US/docs/Web/API/Location/hr...




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

Search: