News for hackers. Stuff that matters.
Re:Law of Demeter and immutability by debacle on Friday September 30, 2016 @11:53AM (#12613202)
I can't think of a programming language used for game development that doesn't have null.
Re:Law of Demeter and immutability by kazagistar on Friday September 30, 2016 @02:50PM (#12614431)
In Rust, an `&Thing` (reference to thing), `Option<&Thing>` (optional reference to thing), `Box<Thing>` (thing on the heap), and `Option<Box<Thing>>` (optional thing on the heap) all have the same in-memory representation of a single pointer, but prohibit accidentally dereferencing a null pointer, and make non-nullable pointers the default.
Re:Law of Demeter and immutability by coldtea on Friday September 30, 2016 @04:10PM (#12614981)
That made my head hurt.
Re:Law of Demeter and immutability by lomnakkus on Friday September 30, 2016 @01:01PM (#12613661)
I'm not sure I understand exactly why this is specific to game development? (I see that the article uses a game-like example, but...)

Even so: I'm pretty sure Rust is suitable for game development being essentially zero-overhead, non-GC and Rust effectively disallows "null".

(That, and C++ if you allow only references like another poster mentioned.)

Re:Law of Demeter and immutability by gpderetta on Friday September 30, 2016 @12:03PM (#12613273)
C++, unless pointers are explicitly used, which weren't in the OP example.