Dialects
Dialect selects source syntax and implicit-variable checking for one file. It must be the first statement in that file, although blank lines and comments may precede it:
Dialect "modern"
Available dialects
The dialect name is case-sensitive and must be one of:
"classic"- traditional Blitz syntax. An unknown variable used in an expression is implicitly created, as in earlier versions."secure"- classic syntax, but an unknown variable used in an expression is a compile-time error. Assignment may still introduce a variable, soscore=1followed byPrint scoreis valid."modern"- secure checking plus colon type annotations and period member access.
Classic and secure source use player.Player for a custom Type annotation and player\health for member access. The traditional %, #, and $ primitive tags work in every dialect.
Modern syntax
Dialect "modern" selects clearer type annotations and period member access alongside secure variable checking:
Dialect "modern" Type Player Field name:Str Field health:Int Field speed:Float End Type Local player:Player = New Player player.name = "Ranger" player.health = 100 player.speed = 3.5
Colon type annotations
Use :Int, :Float, and :Str for the core value types, or append a custom Type name to annotate an object reference. The same form works with locals, globals, fields, arrays, loop variables, parameters, and return types.
Local score:Int Global title:Str = "Arena" Dim players:Player(31) Function CreatePlayer:Player(name:Str) Local player:Player = New Player player.name = name Return player End Function
Period member access
Use a period to access fields. In Extended mode, the same spelling is used to call a Type Method:
player.health = player.health - 10 player.Update()
Compatibility and safety
The traditional %, #, and $ type suffixes remain valid, as do value.Type custom-Type tags and value\member field access. Colon also remains the statement separator, although keeping one statement per line is usually easier to read.
Modern dialect includes secure checking for unknown variables used in expressions. An assignment can still introduce a variable.
Included files
A dialect is not inherited by Include. Every included file selects its own dialect; a file without a Dialect statement uses its compatibility default. When an Include ends, parsing resumes in the including file's dialect.
Dialects and language modes
Dialect is independent of the IDE/compiler Original and Extended language-mode setting. Language mode controls which Blitz3D+ features and runtime commands are available. Dialect controls the spelling and safety rules inside each source file. Without an explicit Dialect, Original mode keeps classic behaviour and Extended mode keeps its existing compatibility behaviour, accepting classic and modern punctuation without secure checking.
Dialect "modern" is available in both language modes and does not enable Extended-only features when the compiler is in Original mode. Select Extended mode separately when a file uses Method, Interface, List, Enum, GUI, shader, physics, or other Extended-only facilities.