Programming Language for Games, part 3
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Sat Nov 1 04:31:29 PDT 2014
Third part of the "A Programming Language for Games", by Jonathan
Blow:
https://www.youtube.com/watch?v=UTqZNujQOlA
Discussions:
http://www.reddit.com/r/programming/comments/2kxi89/jonathan_blow_a_programming_language_for_games/
His language seems to disallow comparisons of different types:
void main() {
int x = 10;
assert(x == 10.0); // Refused.
}
I like the part about compile-time tests for printf:
http://youtu.be/UTqZNujQOlA?t=38m6s
The same strategy is used to validate game data statically:
http://youtu.be/UTqZNujQOlA?t=55m12s
A screenshot for the printf case:
http://oi57.tinypic.com/2m5b680.jpg
He writes a function that is called to verify at compile-time the
arguments of another function. This does the same I am asking for
a "static precondition", but it has some disadvantages and
advantages. One advantage is that the testing function doesn't
need to be in the same module as the function, unlike static
enums. So you can have the function compiled (separated
compilation). Perhaps it's time for DIP.
Bye,
bearophile
More information about the Digitalmars-d
mailing list