News for hackers. Stuff that matters.

hjl22

Re:Literature review on the benefits of static types on Saturday October 07, 2023 @02:36PM (#37804312)
Fair! They are comparing it to Erlang and Go, which are both languages designed with concurrency as a core principle. It just seems off, I guess. I can't actually read the linked article that talks about this as it's locked behind a login wall.
Re:Literature review on the benefits of static types on Saturday October 07, 2023 @01:59PM (#37803992)
Well, the article mentions up front that people will debate the language categories, but Objective-C is definitely a dynamic, runtime-based language. #import <objc/runtime.h>, have fun, go to town. That being said, the compiler does behave rather statically with respect to type-checking, so fair enough I guess.

I feel strongly that dynamic typing leads to poor reliability, and in particular the special-case of "dynamic typing" that creeps into "static" languages: implicit nullability of all (or most, e.g. not Java primitives) types in static languages. The "billion dollar mistake". This is lost in these discussion, Java is "dynamically typed" insofar as every reference type is either what you think it is, or possibly another type that will blow up your entire application if you handle it in the wrong way.

I'm not an academic at all. I don't even have a CS degree. But, I've worked as a rather senior IC on applications with billions of users and with billions and billions of dollars in revenue, the usual "company everyone has heard of" stuff. Nullability has caused so many bugs for us that we could have caught with a compiler. These studies appear to focus on contrived cases or on smaller teams with small or even temporary codebases. This is very different in practice from a decade-old codebase with hundreds or thousands of contributors, some of whom will be interns hopped up on a bit too much free Red Bull. Putting up a wall "you cannot create this kind of bug" is hugely valuable for us, i.e. the transition from Java to Kotlin in Android applications, or Objective-C to Swift in iOS applications.

The article talks about "bugs" as if all bugs are equal, but they are not. Shipping a crash on startup in a mobile or desktop application is an absolute disaster. All hands on deck. Hopefully there's a way to mitigate it. Breaking one feature with some decently graceful recovery is also a "bug", but it is drastically different in terms of negative impact for the company.

This stood out in particular:

> ...CoffeeScript are rated as having few concurrency bugs

I mean, a language with that does not really support threads has few concurrency bugs? Did the authors understand what CoffeeScript is? (I am discounting web workers because AIUI CoffeeScript had largely fallen out of relevance before they were a thing) This is similar to saying Java has fewer memory safety bugs than C, well obviously it does! That is one of the things it was specifically designed to do!

Re:Thread-per-core on Saturday October 07, 2023 @01:45PM (#37803838)
Thanks for the explanation. I understand it now.
Re:Thread-per-core on Saturday October 07, 2023 @01:45PM (#37803837)
Thanks for the explanation. I understand it now.
Re:Thread-per-core on Saturday October 07, 2023 @01:45PM (#37803836)
Thanks for the explanation. I understand it now.
Re:Thread-per-core on Saturday October 07, 2023 @01:45PM (#37803835)
Thanks for the explanation. I understand it now.
Re:Thread-per-core on Friday October 06, 2023 @12:03PM (#37792539)
I haven't touched async Rust, but have used normal Rust a little bit.

My understanding is that 'static is program lifetime, meaning either static compile-time data like constant strings, or it is memory leaks. How does this apply to async in practice? Do you need to leak things that you want to make async?

Re:Thread-per-core on Friday October 06, 2023 @12:01PM (#37792512)
There are plenty of applications that do not run on servers. Lots of IO bound stuff in mobile or desktop apps - waiting for network responses, reading data files on startup, etc.