Comment by lomase

Comment by lomase 2 hours ago

3 replies

Lets count the number of comercial sucesful released games that don't use mutability or object orientation....

I can't find any.

quaunaut 41 minutes ago

> Lets count the number of comercial sucesful released games that don't use mutability or object orientation.... > > I can't find any.

They use it, but the best tend to minimize mutability. And as for object orientation- merely 'having classes' is not the same thing.

simoncion 2 hours ago

> Lets count the number of comercial sucesful released games that don't use mutability or object orientation....

1) I suspect game engines that Carmack designed towards the end of his career are built in a largely-functional style. He's on record [0] as thinking that writing code in a functional style is generally a good thing to do.

2) Running on the BEAM doesn't mean that you give up mutability. In my experience with Erlang, functions that return updated state are very, very, very common. Similarly, functions that mutate state external to the function [1] are also common... it's rare that a program that has no visible effect on the outside world is useful.

It's generally quite a lot easier to understand what your program does when most or nearly all of its functions take input and return output without mutating external state as a side effect.

[0] There's some Twitter thread of his that I CBA to find saying -in effect- "Writing in a functional style makes your code much easier to understand. Obviously, if you're writing a video game, you have to pass around pointers for efficiency reasons, but that doesn't preclude writing most of your code in a functional style."

[1] Such as in an ETS table, a external database, with a network call to a remote system, or even writing data to disk.

sph 2 hours ago

Meh, I remember hearing that no one would release a commercially successful game in a managed language with a GC 15 years ago. Time flies.

Most things are said to be impossible until someone tries to do it anyway.