Differences

Differences from GDScript

GDScriptD
Variables
Instantiation:var n = Node.new()auto n = memnew!Node;
Deletion:n.free()memdelete(n);
Reference-counting:All vars inheriting Reference are automatically ref-countedRef!ArrayMesh rc = memnew!ArrayMesh; // explicit Ref!T wrapper increments ref-count
Dynamic typing:All vars are dynamically-typedVariant v; // accepts any Godot-compatible type
Checking inheritance:if n is Node2D:if(n.as!Node2D) // null if n doesn't inherit Node2D
Scripts
Inheritance:class MyNode extends Node:class MyNode : GodotScript!Node { }
Export method:func _ready(): # automatically exported@Method void _ready() { }
Export property:export var text = "asdf"@Property String text = gs!"asdf";
Global variables:Autoloaded singleton nodes onlyAutoloaded singleton nodes; alternatively, D variables declared outside any class, or as static inside a class
Naming conventions
Class/node:PascalCasePascalCase
Function/variable:snake_casecamelCase
Constant/enum:ALL_CAPScamelCase
Mathin global scopein std.math
abs
acos
asin
atan
atan2
ceil
cos
cosh
deg2radx*(PI/180)
exp
floor
fmod
is_infisInfinity
is_nanisNaN
log
nearest_po2x.isPowerOf2 ? x : x.nextPow2
PI
pow
rad2degx*(180/PI)
round
signsgn
sin
sinh
sqrt
tan
tanh
Algorithmsin global scopein std.algorithm
clamp
max
min
Other functionsin global scope
assertassert keyword
loadResourceLoader.load
preloadnot usable from D
printgodot.d.output.print
Constants and enumsGlobals in global scopein godot.globalconstants
Class constants:Material.RENDER_PRIORITY_MAXMaterial.Constants.renderPriorityMax

Meta