
John Carmack: “I just dumped the C++ server I wrote for a new one in Racket” - tilt
https://twitter.com/ID_AA_Carmack/status/577877590070919168
======
archagon
It's refreshing how humble Carmack always sounds in his Twitter feed. I've
found that old school game programmers tend to be hardline and a bit
belligerent about their code; Carmack, on the other hand, often tweets about
going against his better instincts and exploring new technologies. Not a lot
of sarcasm or negativity at all. If only more people had Twitter streams as
pleasant and informative as his!

~~~
staunch
Carmack is constantly challenging himself. A trait common among masters. Louis
CK is so good at comedy because he throws away all his material each year.
Carmack used to practically write a new game engine every year. Now he's doing
_even more_ challenging work than that.

~~~
sz4kerto
Arthur Whitney, author of A+,k and kdb/q always starts from scratch when he
develops a new version of his db. From scratch means throwing away even the
lowest-level routines like basic string operations and low-level file i/o.

~~~
swah
And the source code is bizarre but... works for him.

------
agentultra
I really love that the majority of the responses to that tweet are of the
form: _Why not X? Use Y!_

It's very illustrative to me of just how tribal we've become. As if it matters
what language Carmack decides to use. I'm sure it's a boon to the Racket tribe
that the others are now jealous of. To have the name recognition of John
Carmack tweeting about your language! Imagine!

Racket is a fine enough language and ecosystem. I'm more curious about what
he's building. Is this the VR-version of Facebook?

~~~
drzaiusapelord
>As if it matters what language Carmack decides to use.

I think if we look at the history of adoption of technology, a lot of it is
driven by the top 1% endorsing it. I think its a pretty big deal when high
profile people endorse a technology. Social capital is as real as financial
capital. Carmack has lots of social capital and it can get results. His
celebrity helped launch Oculus from a weirdo company playing with 90s relics
to a Serious Threat to The Status Quo and I'm sure drew in big investors and
eventually Facebook's purchase of it.

>It's very illustrative to me of just how tribal we've become.

This is how we've always been and will forever continue to be.

~~~
agentultra
> I think if we look at the history of adoption of technology, a lot of it is
> driven by the top 1% endorsing it.

I suppose this might be true but it's rather hard to quantify. I don't recall
ever choosing to invest in and master a language from a celebrity endorsement.
Some people might have -- I can't say. But it obviously does have merit
because of the responses Carmack's tweet solicited so I don't disagree.

I just found that the majority of responses were of this patronizing sort. If
Carmack is amongst the top 1% of programmers, as you say, and is a minor
celebrity as we both know then it seems disingenuous to immediately ask him,
"Why not Haskell/Erlang/Clojure/Whatever-my-favorite-X-is?" Given his previous
essays on functional programming and his move to adopt C++ I think it's safe
to say he knows what he's doing and picked Racket for good reasons (even if
it's as simple as, "I like it."). I made the tribe observation when it became
apparent to me that perhaps they were jealous that Carmack didn't pick their
tribe and bring his celebrity power along to them.

I find that kind of sad and funny. I'm more curious as to what he's building
than what language he's using to do it with. There are interesting things to
talk about wrt the system he's building and the run-time he's building it on
but that seems to go over the majority of peoples' heads. Even as a newcomer
to the Racket ecosystem I think Carmack will have quite a lot to teach us as
he develops this system: about Racket, the language VM, system architecture,
his process, etc.

So when I said, "As if it matters what language Carmack decides to use," what
I was implying was that he probably has reasons and it's more interesting to
know what those are. He could have continued writing it in C++, Haskell,
anything... it's what he does choose, as opposed to the multitude of choices
he didn't make, that is interesting here in my opinion.

------
GreaterFool
It is not hard to write code in Racket or Clojure; what's hard is maintaining
it!

I've written a small Clojure project, maybe 3k loc. It was great fun. But when
I go back to add small features I find it quite tricky. Bugs often sneak in.

~~~
biesnecker
I think maintaining old software is a known problem, regardless of the
language. What about lisps make them more challenging in this regard?

~~~
GreaterFool
Lack of types.

I don't want to start a discussion here on typed vs untyped so please consider
everything I say to be qualified "It is only my personal opinion and
experience".

I'm writing Haskell in my day job, Clojure for fun side project, OCaml because
it's a nice language that's a bit underused and C++ because it's useful to
know and not so evil as most people say (and it's progressing fast!). I should
throw Rust into the mix because it might have a bright future.

WARNING: personal opinions and anecdotal evidence ahead!

Maybe there's a level of lisp enlightenment that I haven't reached yet but I
can't just get by with writing lisp without writing tests. On the other hand I
can get by with writing Haskell and OCaml without writing tests.

This is particularly true when I'm coming back to a project that I haven't
touched for a few weeks. I change something and something breaks. In Haskell
and OCaml I change something and compiler complains.

Maybe we'll see HaLispML one day.

~~~
jacobm
The types objection may apply to Clojure (I've never used it, I don't know)
but one of Racket's major development thrusts has been providing a way to get
the benefits of both typed and untyped languages.

* Racket has a sophisticated contract system that allows you to enforce "type-like" properties at runtime very easily (e.g., you can say "This function should behave as an ((int -> int) -> int) function" and it will do all the necessary runtime checks to make sure that contract is honored as your program executes)

* It also has an optional modern type system, Typed Racket, that you can opt into on a per-module basis. Typed Racket modules can interact with untyped modules safely via contracts. The Typed Racket type system was designed specifically so that it's easy to migrate untyped, idiomatic Racket code to the type system, so you can write untyped Racket code idiomatically, and then go back and port your untyped module to Typed Racket with a minimum of fuss and get the benefit of the type system.

~~~
steveklabnik
Clojure has Core.Typed, which lets you add optional typing.

~~~
ufo
Core.Typed is directly inspired by typed racket :)

------
TheMagicHorsey
Carmack has a secret affection for Lisps I think. A while back he wrote about
programming in lisp on his iPad (which is nicely suited to editing
S-expressions).

Anyway, Carmack has convinced me to take a look at Racket again. When I looked
at it a few years back, it seemed nobody was using it.

~~~
dogma1138
Well the only other thing i know of which is written in Racket is HN. So not
sure if it's any popular today either. IMO it looks like were getting too many
damn programming languages which is something I'm starting to really dislike.
Too much shit flying around forcing you to pickup some niche languages for a
project, and worse having fresh developers being forced to learn like a
billion languages instead of mastering 1 or 2.

~~~
andrewchambers
Learn scheme and you can handle all lisps, learn C/C++ and you can handle all
the imperative languages, learn ocaml/haskell and you can handle the rest.
That is 3 languages to master.

~~~
FreeFull
Until you come to Prolog, or APL/J/K and realise that none of these languages
have fully prepared you either. And then there are other things out there too,
that will leave you learning all over again.

~~~
jevgeni
I have this ritual every year or so, where I try to write J, sigh, and go back
to pedestrian F#.

~~~
eggy
I always do one-liner stuff in J, and I keep trying to get into F#. I recently
bought Dyalog's APL. I thought the symbols would get in the way, but it's a
whole other door opening. I really like the array-oriented languages for math
and science. Even Julia and Numpy are attempts to do what the APL/J/K family
have always done. I've always had Racket on my machine, before it was called
Racket. Having an IDE and a good standard library right off the bat is great
for beginners and dabblers like myself. I do not program for a living. I only
program when I have a math or engineering problem to solve.

~~~
jevgeni
Racket is amazing, I agree. :)

------
davexunit
Always interesting to see what Carmack is up to in Lisp land. It's
particularly interesting to me because he seems to have some sort of Lisp
guilt. Every time he talks about it, he has to mention that he's not sure if
it's useful for "serious" projects because it's not statically typed or
because it might not scale.

~~~
fizixer
I remember him (either in the QuakeCon 2013 talk, or one of his writings)
mentioning that all these years he was so busy he never got a chance to have
his lisp enlightenment. I think he might be having it now.

------
waterlesscloud
I've been vaguely aware of Racket, but I haven't paid much attention to the
details.

If I'm reasonably familiar with Common Lisp, what are the main
differences/advantages of Racket to pay attention to? What's the best resource
(preferably online) to use to learn about Racket?

~~~
ethagnawl
> What's the best resource (preferably online) to use to learn about Racket?

You could work through SICP using Racket instead of MIT/GNU Scheme. I'm
currently in the midst of this and the differences thus far have been
relatively minor (e.g. Racket doesn't have `inc`, `dec` or `nil`).

~~~
dghf
> e.g. Racket doesn't have `inc`, `dec` or `nil`

I'm assuming those are trivial to add?

~~~
JimmyM
Yeah, you could add 'nil' easily.

inc and dec I assume mean increment or decrement (I have no experience with
CL) - racket/base includes (add1 .) and (sub1 .) for the same effect. If they
didn't exist they would be trivial to add I think - if this isn't what inc and
dec mean then I apologise.

In Scheme/Racket truth and falsity is really simple - #f is false and
everything else is truthy. There's also already a null value for the empty
list (which is 'true'). I don't know if nil would be useful.

~~~
dghf
And it looks like someone's already done it: [http://planet.racket-
lang.org/package-source/neil/sicp.plt/1...](http://planet.racket-
lang.org/package-source/neil/sicp.plt/1/13/main.ss)

~~~
JimmyM
I dunno it looks to me like they've just defined nil to be equal to
null/empty, which is not exactly the same.

In Common Lisp, unlike Scheme/Racket, nil is the null value AND the false
value. In Scheme/Racket, 'nil is true unless you define it to be #f. If you
wrote an if or cond expression to evaluate the 'nil in the link, I think that
it would return true, whereas in CL nil is falsy (I think it is the only falsy
value in CL, but I would still describe it as 'falsy' rather than false,
possibly incorrectly).

e: Ah, I see why I'm not understanding you now - you're talking about the
differences between Racket and SICP/Scheme whereas I made the assumption that
we were talking about the difference between Common Lisp and Racket (from OP's
comment). To further clarify, I believe this was my fault in comprehension,
not yours in communication.

~~~
dghf
> I dunno it looks to me like they've just defined nil to be equal to
> null/empty, which is not exactly the same.

But it is how nil is defined in SICP:

'The value of nil, used to terminate the chain of pairs, can be thought of as
a sequence of no elements, the empty list. The word nil is a contraction of
the Latin word nihil, which means "nothing."' \--
[http://mitpress.mit.edu/sicp/full-text/book/book-
Z-H-15.html...](http://mitpress.mit.edu/sicp/full-text/book/book-
Z-H-15.html#%_idx_1596)

And then in a footnote to that paragraph:

"It's remarkable how much energy in the standardization of Lisp dialects has
been dissipated in arguments that are literally over nothing: Should nil be an
ordinary name? Should the value of nil be a symbol? Should it be a list?
Should it be a pair? In Scheme, nil is an ordinary name, which we use in this
section as a variable whose value is the end-of-list marker (just as true is
an ordinary variable that has a true value). Other dialects of Lisp, including
Common Lisp, treat nil as a special symbol. The authors of this book, who have
endured too many language standardization brawls, would like to avoid the
entire issue. Once we have introduced quotation in section 2.3, we will denote
the empty list as '() and dispense with the variable nil entirely." \--
[http://mitpress.mit.edu/sicp/full-text/book/book-
Z-H-15.html...](http://mitpress.mit.edu/sicp/full-text/book/book-
Z-H-15.html#%_idx_1598)

------
nacs
> but it is winning for development even as a newbie

Not sure Carmack qualifies as a newbie when it comes to anything programming-
related.

~~~
Guthur
In my opinion anyone can be a newbie once taken out of their comfort zone.

John Carmack was mostly a C programmer up until quite recently and then
started experimenting with some Functional Programming languages, and I'm sure
he had a few things to learn when doing so.

Not to take away from an obviously intelligent individual.

~~~
Dewie
> Not to take away from an obviously intelligent individual.

It's interesting to observe how programmers and other similar _intellectual_
workers prostrate themselves in their own specific way when referring to
someone of high status in their field.

~~~
astrocyte
I tend to observe that seasoned/good software engineers are too busy tackling
problems of similar difficulty to be caught up praising, following, and
prostrating themselves to others. It's not a habit of mine and I don't hold
anyone who does it in high esteem. I tend to think someone praises another to
a large extent because they don't hold themselves in high regards. If they did
and were of similar skill level, it wouldn't seem a big deal to them right?
i.e : Tweet (high profile software engineer) : Today I cut 500ms out of a 4
second operation on a consumer device Me : OK .. last week I cut a 10 second
switch-over operation on a enterprise switch (grosses 8 billion dollars in
revenue a year) down to 300ms. I thought that was just a part of my job as a
software engineer.

~~~
ryandvm
I think that may be the most annoying post I've read on Hacker News this year.

------
GrandTheftR
> John Carmack ‏@ID_AA_Carmack 3h3 hours ago > @touristtam If I run into
> catastrophic perf problems, I may try rewriting in Go.

he apparently has lots of fun with languages, very curious what kind of server
he is writing now.

He also spoke highly about Haskell before.

~~~
touristtam
Hi I did ask the following:

> thoroc ‏@touristtam 12h12 hours ago > @ID_AA_Carmack what guided your choice
> of Racket vs Rust and Go? > Just curious. :)

------
jdeisenberg
I've always thought Racket to be a highly under-rated language.

~~~
Johnny_Brahms
I use it for everything I write. It brings the joy back after having to
maintain a Java project in my day job. Well written racket code brings so much
satisfaction :)

------
mahyarm
I wonder what kind of server it is. What is it's purpose?

~~~
fjarlq
_" multi-user VR stuff"_

[https://twitter.com/ID_AA_Carmack/status/577889129284898816](https://twitter.com/ID_AA_Carmack/status/577889129284898816)

------
yoanizer
...* after reading some of the comments here *...

I think we would be better off caring a little bit less about what language to
use and a little bit more about what programs to write.

------
fitzwatermellow
Had to read that twice. Was pretty sure he meant "RakNet" the first time ;)

Oh, and just gonna put this out there:
[http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...](http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=racket&lang2=go)

~~~
e12e
Then again:
[http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...](http://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=racket&lang2=hipe)

and Erlang is certainly a valid platform for servers, so as usual benchmarks
are just benchmarks... would be interesting to see if typed racked made a
difference in these tests -- although I'm not sure if performance is the main
focus of typed racked (as opposed to just type safety).

~~~
igouy
[http://www.erlang.org/faq/introduction.html#idp32166576](http://www.erlang.org/faq/introduction.html#idp32166576)

------
rasz_pl
>May not scale, but it is winning for development even as a newbie

Sounds like Python.

Works great at the start, and then one day you wake up and realize you are
running 50K ppl online at the same time MMO (Eve Online), your code cant take
advantage of multi core CPUs = every game region (star system) starts to lag
above ~500 people and there is nothing you can do about it.

------
fasdjkjksdf
Honestly, just about anything is going to be faster, productivity-wise, than
C++. When you stop having to think about how you're going to structure your
inheritance and classes, you--shockingly--get things done. But more
metaprogramming is not the answer. And I've used Scheme since 2002 or so. I'm
implemented Scheme interpreters and compilers. But I'm no longer a cheerleader
for macros and call/cc or Scheme (or Lisp, for that matter).

You know what gets things done and makes things easy to maintain? Boring ass
code. IF statements. FOR loops. I mostly use Perl today. It doesn't get in the
way. But getting things done is not trendy. That's where we are today.

~~~
nine_k
You know what's the problem with boring code? It's boring. This means its
information content is low, and its abstraction level is low. This means that
you need more of it to express an algorithm.

When you have a lot of wordy, boring code to maintain, you have to make
coordinated changes in more similarly boring places. A human's brain can only
keep that many lines of context. So it becomes easier to make a mistake.

I understand that abstraction astronautics can leave you with puzzling,
convoluted, hard-to-maintain code full of leaky unintuitive abstractions. This
problem is not unique to Lisp macros; languages like C++ and even Java are
known to be widely used by perpetrators of the above-mentioned atrocities.

What makes code easier to maintain is clear separation of concerns and low
impedance between code's abstractions and the subject area. This is, again,
attainable in a number of languages (though expressive power and minimalism
help make it even nicer), given the right mindset and skills. I suppose John
Carmack possesses both.

~~~
mrits
I recently watch a colleague write an elaborate system to parse a few
different CSV feeds. There are a dozen different interfaces and mixed in with
all the lovely Java design patterns.

I'm beginning to use a phrase that I'd rather deal with poorly written code
than well planned architecture. Obviously by well planned architecture I'm
referring to overly architected solutions.

~~~
chipsy
When it comes to architecture, I've lately turned towards BCNF as my god. My
premise is that if my data model - my internal application data, not just "the
database" \- is as in as normalized a form as I can reasonably get it given
typical constraints of procedural/OO/functional styles, my features
automatically grow into a flexible and decoupled grain because they're
operating on exactly the right slice of data, no more, no less. "Guess and
check" and "OO design pattern" strategies don't seem to get me there because
they tend to start with whatever is language-easy or looks pretty at first
glance, and then take on the problems later. And it seems to work - the thing
I have right now is, indeed, incredibly flexible for the amount of code
involved. And it isn't really "architected" in the usual sense otherwise -
there are no grand plans.

The only problem I'm having with this tack is that it reveals all the
technical debt at once, which produces an enormous amount of pain early on. My
friends smirked at my woes today of trying to make a clickable button, which
has to piece together stuff from the graphics layer, input events, text
fields, and internal button state. An enormous variety of data, altogether,
with the debt usually hidden from view at some level. It all makes sense, it's
all decoupled, the lifetime of the state is automatically managed, any
configuration you want will just be a matter of making the data for it. But
making that first button is quite a headache.

~~~
agumonkey
I had a funny feeling doing a SQL MOOC when I had to re-learn normalization,
and how it was a very generic decoupling algorithm. Suddenly all OOP became
tiny and ad-hoc.

~~~
nekopa
Would you mind telling me which MOOC you did for SQL? I am quite rusty - (~10
years since I did any serious SQL stuff) but I am finding it is coming up
quite a lot now for me.

~~~
agumonkey
IIRC it was Stanford's (I have memories of a mainly red interface)

[http://www.erictimmons.com/node/18](http://www.erictimmons.com/node/18)

I don't know if it qualifies for serious, I'd say challenging enough, but it
was great to revisit with another university material.

~~~
nekopa
Thanks for that. In case anyone else is interested, they now have it set up as
a self-paced course here:

[https://class.stanford.edu/courses/DB/2014/SelfPaced/about](https://class.stanford.edu/courses/DB/2014/SelfPaced/about)

------
Dewie
I guess this is where the anti-FP people forget their staunch scepticism for a
second because a respected imperative programmer uses an FP language? Regular
functional programmers haven't been able to change their view, but I wouldn't
be surprised if all it took was one tweet from the right person.

Other than that, I don't see what else there is to say about this. 'Dropped
some C++ for Racket server: may not scale but is more productive'. That's the
most standard high-level vs. low-level dichotomy.

~~~
AceJohnny2
> I wouldn't be surprised if all it took was one tweet from the right person.

Well, the "Argument from Authority" is called out because of when it's misused
(kinda how "experts are always wrong". No: those are only the times you
remember), but it _is_ a fundamental way of how social humans form opinions.

~~~
Dewie
> , but it is a fundamental way of how social humans form opinions.

Wow, that's amazing: people form opinions in part based on how much they
respect/trust someone. Consider my cynical views totally and irreversibly
changed.

Then there are those times when it is taken too far: like 115 points on HN for
a pithy message like "rewrote to another language".

------
andrewstuart
So many brackets. Resolving mismatched brackets seems to be just about the
most pointless developer activity possible.

~~~
kenferry
Lisp uses the same number of parens as most languages per call – the only
thing that's different is whether the paren goes before or after the first
part of the call.

    
    
        (print "hello") 
    

vs

    
    
        print("hello")
    

So to the extent Lisp is paren-heavy, it's more a stylistic thing. Lisp
programmers tend to chain up calls more.

~~~
UnquietTinkerer

        (-b + sqrt(b*b - 4*a*c)) / (2*a)
        (/ (+ (- b) (sqrt (- (* b b) (* 4 a c)))) (* 2 a))
    

It does depend on your use case.

~~~
yogthos
That's why we have macros [http://liebke.github.io/incanter/infix-
api.html](http://liebke.github.io/incanter/infix-api.html)

[https://github.com/incanter/incanter/blob/master/modules/inc...](https://github.com/incanter/incanter/blob/master/modules/incanter-
core/src/incanter/infix.clj)

~~~
kazinator
Lisp only has infix macros so that we can say "we have that".

Nobody in their right mind uses this stuff in production code.

It just overcomes objections. "Oh, if I start using Lisp, there _is_ be a way
to use infix, should I really need it". Ten years and six Lisp project later,
you still haven't used the infix stuff; the situation never comes.

~~~
jakub_h
> Nobody in their right mind uses this stuff in production code.

You sure about that? I thought the lispy approach was generally pragmatic -
you use what you deem handy for your application. It this weren't the case,
there would be little need for macros in the first place. I can very well
imagine, say, a scientific or engineering application that would share a
common infix parser for both user-provided expressions (in the UI, to be more
friendly to non-lispers) and heavy math lifting in the source code.

------
lawnchair_larry
A random Carmack tweet is news now?

~~~
jpgvm
Carmack is an interesting fellow, especially interesting to the types that
frequent this forum.

What he is doing is thus interesting to this forum though maybe as you
pointed, not news worthy.

But since when does everything has to be news worthy?

