Programming Language for Games, part 3
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Sat Nov 1 13:14:11 PDT 2014
On 11/1/2014 4:31 AM, bearophile wrote:
> Third part of the "A Programming Language for Games", by Jonathan Blow:
> https://www.youtube.com/watch?v=UTqZNujQOlA
Jonathan is reinventing D with a somewhat different syntax. Some points on the
video:
* The defer statement works pretty much exactly like D's scope guard:
http://dlang.org/statement.html#ScopeGuardStatement
* "for n: 1..count" is the same as D's "foreach (n; 1..count)"
* dynamic arrays work pretty much the same as D's
* for over an array in D:
foreach (it; results) ...
* D does the check function thing using compile time function execution to check
template arguments.
* D also has full compile time function execution - it's a very heavily used
feature. It's mainly used for metaprogramming, introspection, checking of
template arguments, etc. Someone has written a ray tracer that runs at compile
time in D. D's compile time execution doesn't go as far as running external
functions in DLLs.
* D has static assert, which runs the code at compile time, too. The space
invaders won't run at compile time, because D's compile time code running
doesn't call external functions in DLLs. I actually suspect that could be a
problematic feature, because it allows the compiler to execute user supplied
code which can do anything to your system - a great vector for supplying malware
to an unsuspecting developer. The ascii_map function will work, however.
More information about the Digitalmars-d
mailing list