Please see the disclaimer.

Read Part 1 and Part 2 first.

Introduction

Okay, Jai has had its time in the limelight; it is Clojure’s turn.

Clojure has all the big things to reduce bugs: memory safety, automatic memory management, and others.

It also tacks on a few more: immutable by default, managed references, open data types, and others.

Memory Safety

I don’t know why Jonathan Blow does not have memory safety in Jai; in my opinion, it is the worst mistake he has made on Jai, bar none. And I believe that he has made more than one grave mistake.

Why is it a mistake? Because of security.

I know game developers generally do not worry about cybersecurity, and that is the reason he did not put it in. However, as the past decade, and especially the past three or so years, have taught us is that it matters, on all levels.

Don’t believe me?

Okay, presume some Steam-based game running on a computer where Spectre (or another speculative execution vulnerability) has not been completely mitigated. Imagine the computer is for a big Twitch personality. And he/she is playing.

Does it take too much imagination to imagine someone, knowing the gamer is playing because he/she is broadcasting, running a remote attack on the game, written in a non-memory-safe language, in order to gain access to Steam and the gamer’s Steam account?

If we want to be professionals, we have to care. All of us. All of the time.

By the way, this is why C and C++ must be ripped out of the industry. It saddens me to say that about C, because I love it (though I would be thrilled if C++ died a torturous death), but it is true. We have better tools; we must use them.

Clojure did the right thing here, obviously.

Automatic Memory Management

Along with memory safety comes automatic memory management and removal of all memory leaks.

But wait, didn’t I talk about manual memory management in the last post? Yes, I did. And Yao will have it. But it will not be default, nor will it prevent the language from preventing all memory leaks.

Until next time…

Immutable by Default

In other words, only reach for sharp tools when you need them.

Why is this not the default on many languages?

This is another terrible mistake by Jonathan Blow. Even worse, he cites John Carmack as an authority, and in that very page, John Carmack has a link to another article that he wrote where he was “even more bullish” about functional programming.

Now, I understand why Jonathan Blow did not go for pure functional programming (neither am I), but just this one small change would have made a world of difference.

Oh well, Jonathan Blow’s mistakes may translate into an opportunity for me.

Managed References

Clojure has something called “managed references.” They basically manage state so that it doesn’t cause things like data races. That is cool.

Open Data Types

What are open data types?

Well, in my mind, they are basically maps where the keys have to be symbols, which are just names. (Think Lisp symbols.)

I am no expert in Clojure, but it seems to be how Clojure does heterogeneous data structures. And it is a little brilliant.

What this means is that data is not set in stone. And Yao will have it, but because of the potential for bugs, it can’t just be used willy-nilly.

Conclusion

So what does this outlook look like for Yao?

Well, I already have a bit of the design in my head. And the next post will be about me putting it all down, in its full mess, in words.