Hacker Newsnew | past | comments | ask | show | jobs | submit | borkido's commentslogin

Comparing the Netherlands with some of the best, if not the best bike infrastructure to other countries without said infrastructure seems very reductionist. To get anywhere near an interesting number you would have to compare the number of injuries to the total number of accidents including cyclists in countries with comparable bike infrastructure and differing helmet policies.


Yeah that's why it's hard to prove. However, it does show that infrastructure experts who actually care about safety (and have achieved the safety numbers to support it) reach for a lot of other measures before they do helmet mandates.


What would the benefit be of not associating functions that operate on a struct with said struct? You would just end up with a bunch of functions that take a struct of that type as their first argument.


> You would just end up with a bunch of functions that take a struct of that type as their first argument.

I don't see that as a necessarily bad thing, it brings uniformity with the rest of the functions. I've coded with libraries like APR, Nginx's API, and GTK's GLib, and the result looks quite aesthetically pleasing too (subjective of course).

I'm also not considering this as a deal-breaker or anything. The point is not that this one particular feature makes a language complex, but rather that features like these tend to pile up, and what once looked like a simple language quickly becomes less simple due to dozens of such simple features added together. But one or two of these is fine.


Unlike C++ all Rust's methods already can be used this way

    '5'.is_digit(10) // Is literally the same as
    char::is_digit('5', 10) // this
Basically all a "method" is in Rust is an associated function where the first parameter has the magic keyword self instead of needing a real name and type.

Rust even has guidelines recommending you consider e.g. &self rather than having an associated function whose first argument has type &Self, but noting that you should not do this if your type has "smart pointer" behaviour where users expect to call methods on the inner value instead. For example Box and Arc provide associated functions but not methods.


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

Search: