Hacker News new | ask | show | jobs
by stephendause 903 days ago
> Imperative programs describe computations by repeatedly performing implicit effects on a shared global state.

Is this necessarily true? In Rust programs, operations do not operate on a shared global state – at least not in the way I think most people would understand 'effects on a shared global state.'

2 comments

The enemy is shared mutable state. Functional languages solve the problem by focusing on immutability and statelessness, whereas Rust solves the problem by letting your state be shared xor mutable.
Tools that prevent the developer from expressing fundamentally invalid ideas? Great. Not so great are:

- Tools that force the user to adopt a mindset that the tool designer prefers; essentially this bounds the expressive power of the tool artificially for aesthetic or other opinions.

- Tools that prevent the user from even understanding the danger that the tool is guarding against. IMO developers need to know what concurrency is, what the range of various numeric types are, how signed values actually work. I know others disagree on this, but idiot-proof tooling doesn’t help people grow past a certain point.

Idiot-proof tooling helps non-idiots, whereas idiots may not by definition be helped in any way.

I know the internal representation of integers and floats and I know how important that knowledge is. I reverse-engineered a gnarly bug in a codebase just last month using it. I'd still rather my programming language have 10*100 resolve to the actually correct answer rather than undefined behavior.

I have written production code with pthreads, but I'd still rather use async if realistic for the task at hand.

I know how to manage my own memory but I'd still rather use a GC'd language if realistic for the task at hand.

I know how to write queries directly to the postgres socket, but I'd still rather use a proper client.

I know how to write code in vi but I'd still rather write code in jetbrains.

(...)

Where does the fascination for not using proper tools come from? I'm reminded of this: https://www.youtube.com/watch?v=3I_Ds2ytz4o

I'd really love to use an IDE, but I haven't found any modern ones that I don't hate. Which is curious, since I used to love the Borland IDEs (Turbo Pascal, Turbo C). Maybe I'm just spoiled, but all the IDEs that I've tried since have managed to turn me off quite thoroughly, in one way or another.
> I'd really love to use an IDE, but I haven't found any modern ones that I don't hate.

I agree with this so very much. The modern IDEs I've used are pretty awful. They get in my way and doing anything uncommon in them often requires a small research project.

Some more so than others, of course. I think my least favorite may be VS, although the Jetbrains offerings are a very close second.

I've taken to just not using an IDE at all for my personal projects. At work, I use what I'm required to use.

Totally agree now that i'm old, but:

> I know how to write code in vi but I'd still rather write code in jetbrains

I hard pass on that, Jetbrains is probably the slowest IDE i have ever used. Probably great if your PC is a war machine, mine usually aren't (company provided ones, and my laptops).

I'd rather code with an old vi with minimal plugin and color support than with Jetbrains. I was highly critical of Netbeans thanks to similar slowness issues when i used it for the first time 11 years ago (it was with a VERY large codebase), but Jetbrains is the worst. And this slowness triggers me too much to do anything.

Like the sibling comment said, Rust is a special case. The ownership model is there to fight shared mutable state.

With respect to other languages, this part is interesting:

> at least not in the way I think most people would understand 'effects on a shared global state.'

You're right - most programmers do not think of it as shared global state, once it's put behind something like 'private', and exposed via getters and setters, but it is.

You can take any race condition you like, wrap the offending operations in getters and setters, and you'll still have the same race condition.