Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
008b900
tutorials/language: add toml + logger tutorials; fix RST drift
borisbat Jun 13, 2026
66a2722
tutorials/macros: add add_module_option tutorial; fix dimExpr->typeMa…
borisbat Jun 13, 2026
de0d102
tutorials/sql: fix column-name drift + add missing nav links
borisbat Jun 13, 2026
efc0728
tutorials/integration-c: fix RST API/output drift
borisbat Jun 13, 2026
cc2092f
tutorials/integration-cpp: fix RST API/CMake drift + fabricated API
borisbat Jun 13, 2026
5630be9
tutorials/dasAudio: fix attenuation formulas + fabricated section
borisbat Jun 13, 2026
55445fb
tutorials/dasHV: fix RST API drift (get_body_bytes, JSON status, clea…
borisbat Jun 13, 2026
799789c
tutorials/dasOPENAI: fix get_env->get_env_variable + brace-escape
borisbat Jun 13, 2026
c60982a
tutorials/dasPEG: fix not_set vs !rule confusion in csv_parser
borisbat Jun 13, 2026
b485693
tutorials/dasPUGIXML: fix missing catalog row in linq tutorial
borisbat Jun 13, 2026
0954a47
tutorials/dasStbImage: fix valid()/blit/pack_rgba RST drift
borisbat Jun 13, 2026
20a51be
tutorials/daStrudel: fix silent s() arpeggio + comment/prose accuracy
borisbat Jun 13, 2026
50ccb06
tutorials/jsonrpc: fix wire-format comment drift
borisbat Jun 13, 2026
2172968
tutorials: fix Sphinx LaTeX title-underline warnings (doc CI gate)
borisbat Jun 13, 2026
dabb966
tutorials/integration: address Copilot review (sync cpp_19 output, cl…
borisbat Jun 13, 2026
14c9e11
Merge pull request #3125 from GaijinEntertainment/bbatkin/tutorials-g…
borisbat Jun 13, 2026
2c45d10
tutorials: fix stale source comments + add panic-model note (audit fo…
borisbat Jun 13, 2026
8ceed65
Merge pull request #3126 from GaijinEntertainment/bbatkin/tutorials-f…
borisbat Jun 13, 2026
339d8c9
tutorials: convert 5 verbatim code blocks to literalinclude (drift-pr…
borisbat Jun 13, 2026
e181bfc
Merge pull request #3127 from GaijinEntertainment/bbatkin/tutorials-l…
borisbat Jun 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/source/reference/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ introduced in earlier tutorials.
tutorials/54_glob.rst
tutorials/55_linq_decs.rst
tutorials/56_linq_query.rst
tutorials/57_toml.rst
tutorials/58_logger.rst

.. _tutorials_building_from_sdk:

Expand Down Expand Up @@ -206,6 +208,7 @@ Run any tutorial from the project root::
tutorials/macros/16_template_type_macro.rst
tutorials/macros/17_qmacro.rst
tutorials/macros/18_with_boost.rst
tutorials/macros/19_add_module_option.rst

.. _tutorials_dashv:

Expand Down
4 changes: 2 additions & 2 deletions doc/source/reference/tutorials/03_operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ Copy vs move — introduction
``=`` is copy assignment — works for simple types and copyable values.
``<-`` is move assignment — transfers ownership and zeroes the source::

var p = 10
let p = 10
var q = p // q is a copy of p
q = 99 // p is unchanged

var s = 42
var r <- s // r gets 42, s is zeroed
let r <- s // r gets 42, s is zeroed

Move matters for arrays, tables, lambdas, and other heap-allocated types.
See :ref:`tutorial_arrays` and :ref:`Move, copy, clone <move_copy_clone>`.
Expand Down
8 changes: 7 additions & 1 deletion doc/source/reference/tutorials/17_move_copy_clone.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Type compatibility
- Yes
- Yes
* - lambda
- No
- Yes (alias)
- Yes
- No
* - iterator
Expand All @@ -93,6 +93,12 @@ Type compatibility
- No
- No

.. note::

``=`` on a lambda copies the fat pointer — both variables share the same
capture frame (aliasing, not an independent copy). See
:ref:`tutorial_lambdas` for details.

Relaxed assign
==============

Expand Down
8 changes: 6 additions & 2 deletions doc/source/reference/tutorials/21_error_handling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ general exception handling — only panics are caught::

.. note::

You cannot ``return`` from inside ``try`` or ``recover`` blocks.
Assign results to a variable instead.
Execution resumes after the ``try``/``recover`` block, but a panic means
the program reached a broken state. Use ``recover`` to capture the failure
(log it, report it) before deciding to stop — **not** as resumable
exception handling and not for soft, expected errors. For those, return a
status value instead — see :ref:`tutorial_option_and_result`. (Consistent
with this, a ``finally`` block is skipped when its body panics.)

assert and verify
=================
Expand Down
2 changes: 1 addition & 1 deletion doc/source/reference/tutorials/23_string_format.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Inside ``{expr}`` interpolation, add ``:flags width.precision type``::
**Flags:**

- ``0`` — zero-pad
- ``-`` — left-align
- ``+`` — force sign
- ``<`` — left-align (e.g. ``{x:<10d}``)

**Type characters:**

Expand Down
48 changes: 6 additions & 42 deletions doc/source/reference/tutorials/32_operator_overloading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,9 @@ Overload ``+``, ``-``, ``*``, ``/``, ``%`` to give your types arithmetic
behaviour. Each operator is a binary function that takes two values and returns
a result:

.. code-block:: das

struct Vec2 {
x : float
y : float
}

def operator +(a, b : Vec2) : Vec2 {
return Vec2(x = a.x + b.x, y = a.y + b.y)
}

def operator -(a, b : Vec2) : Vec2 {
return Vec2(x = a.x - b.x, y = a.y - b.y)
}

def operator *(a : Vec2; s : float) : Vec2 {
return Vec2(x = a.x * s, y = a.y * s)
}

def operator *(s : float; a : Vec2) : Vec2 {
return a * s
}

def operator /(a : Vec2; s : float) : Vec2 {
return Vec2(x = a.x / s, y = a.y / s)
}
.. literalinclude:: ../../../../tutorials/language/32_operator_overloading.das
:language: das
:lines: 27-50

Usage::

Expand Down Expand Up @@ -122,22 +99,9 @@ Overload ``+=``, ``-=``, ``*=``, ``/=``, ``%=``, ``&=``, ``|=``, ``^=``,
``<<=``, ``>>=`` and others for in-place modification. The first argument must
be ``var ... &`` (mutable reference):

.. code-block:: das

def operator +=(var a : Vec2&; b : Vec2) {
a.x += b.x
a.y += b.y
}

def operator -=(var a : Vec2&; b : Vec2) {
a.x -= b.x
a.y -= b.y
}

def operator *=(var a : Vec2&; s : float) {
a.x *= s
a.y *= s
}
.. literalinclude:: ../../../../tutorials/language/32_operator_overloading.das
:language: das
:lines: 145-158

Usage::

Expand Down
2 changes: 1 addition & 1 deletion doc/source/reference/tutorials/44_compile_and_run.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ section.
options gen2
options multiple_contexts // required when holding smart_ptr<Context>

require daslib/rtti
require daslib/ast
require daslib/debugger
require daslib/jobque_boost

Expand Down
8 changes: 5 additions & 3 deletions doc/source/reference/tutorials/46_apply_in_context.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,17 @@ From the caller's perspective, these look like normal functions:
init_counter_service()
print(" increment() = {increment()}\n")
print(" increment() = {increment()}\n")
print(" increment() = {increment()}\n")
print(" get_counter() = {get_counter()}\n")
add_to_counter(10)
print(" after add = {get_counter()}\n")
print(" after add_to_counter(10) = {get_counter()}\n")
print(" local counter = {counter}\n")
// output:
// increment() = 1
// increment() = 2
// get_counter() = 2
// after add = 12
// increment() = 3
// get_counter() = 3
// after add_to_counter(10) = 13
// local counter = 0

The agent context's ``counter`` is modified — the caller's local
Expand Down
37 changes: 6 additions & 31 deletions doc/source/reference/tutorials/47_data_walker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,9 @@ A ``DapiDataWalker`` subclass overrides only the callbacks you need.
All 87 methods default to no-ops, so a minimal walker that prints
integers, floats, strings, and booleans is very small:

.. code-block:: das

class ScalarPrinter : DapiDataWalker {
def override Int(var value : int&) : void {
print(" int: {value}\n")
}
def override Float(var value : float&) : void {
print(" float: {value}\n")
}
def override String(var value : string&) : void {
print(" string: \"{value}\"\n")
}
def override Bool(var value : bool&) : void {
print(" bool: {value}\n")
}
}
.. literalinclude:: ../../../../tutorials/language/47_data_walker.das
:language: das
:lines: 41-54

To walk a value, create the walker, wrap it with ``make_data_walker``,
then call ``walk_data`` with a pointer and ``TypeInfo``:
Expand Down Expand Up @@ -375,21 +362,9 @@ Mutating data in-place
Scalar callbacks receive ``var value : T&`` — a mutable reference.
This means the walker can modify data during traversal:

.. code-block:: das

class FloatClamper : DapiDataWalker {
lo : float = 0.0
hi : float = 1.0

def override Float(var value : float&) : void {
if (value < lo) {
value = lo
}
if (value > hi) {
value = hi
}
}
}
.. literalinclude:: ../../../../tutorials/language/47_data_walker.das
:language: das
:lines: 767-779

Walking a ``Particle`` with out-of-range floats clamps them to
``[0..1]``:
Expand Down
2 changes: 1 addition & 1 deletion doc/source/reference/tutorials/50_soa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Prerequisites: familiarity with structs and arrays.
.. code-block:: das

options gen2
options no_unused_function_arguments = false

require daslib/soa
require math


What is SOA?
Expand Down
2 changes: 1 addition & 1 deletion doc/source/reference/tutorials/51_delegate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Prerequisites: familiarity with lambdas, function pointers, and typedefs.
.. code-block:: das

options gen2
options no_unused_function_arguments = false

require daslib/delegate
require math


Declaring delegate types
Expand Down
2 changes: 2 additions & 0 deletions doc/source/reference/tutorials/56_linq_query.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,5 @@ exact scope.
Full source: :download:`tutorials/language/56_linq_query.das <../../../../tutorials/language/56_linq_query.das>`

Previous tutorial: :ref:`tutorial_linq_decs`

Next tutorial: :ref:`TOML <tutorial_toml>`
Loading
Loading