You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,10 @@ Task-specific instructions are split into skill files under `skills/`. You MUST
36
36
37
37
Multiple skill files may apply to a single task. For example, creating a new daslib module requires reading `skills/das_formatting.md`, `skills/daslib_modules.md`, and possibly `skills/documentation_rst.md`.
38
38
39
+
### Updating Instructions with New Knowledge
40
+
41
+
When you discover something new about daslang syntax, semantics, or conventions — whether through compiler errors, user corrections, or experimentation — **update this file** (and its `.github/copilot-instructions.md` mirror) with the new knowledge. Add it to the appropriate section (gen2 syntax, common gotchas, etc.) so future sessions benefit. If it relates to a specific skill area, update the relevant `skills/*.md` file too.
42
+
39
43
## daslang Language — Gen2 Syntax (REQUIRED)
40
44
41
45
All code examples and documentation MUST use gen2 syntax (add `options gen2` at the top of every file). Key rules:
@@ -57,6 +61,7 @@ All code examples and documentation MUST use gen2 syntax (add `options gen2` at
57
61
-**Bitfield dot access:** read with `f.flag` (returns bool), write with `f.flag = true/false`
58
62
-**`typeinfo`** gen2 syntax: trait name goes **outside** parentheses — `typeinfo trait_name(type<T>)`, NOT `typeinfo(trait_name type<T>)`. With subtrait: `typeinfo has_method<name>(type<T>)`. With two traits: `typeinfo trait<sub;extra>(type<T>)`
59
63
-**`static_if`:**`static_if (condition) { ... }` — parentheses required in gen2
64
+
-**Type function call:**`take(type<int>, 1, 2)` — NOT `take < int > (1, 2)`. The `type<T>` is passed as a regular argument
60
65
61
66
### Important defaults
62
67
@@ -186,6 +191,7 @@ All code examples and documentation MUST use gen2 syntax (add `options gen2` at
186
191
- Blocks CANNOT be stored in containers, returned from functions, or captured — use lambdas or function pointers for those use cases
187
192
-`match`, `multi_match`, `static_match` macros (from `daslib/match.das`) handle side effects automatically — do NOT add `[sideeffects]` annotations to functions that only use match
188
193
-`[export] def main()` returns `void` — do NOT `return true` or return other values from main
194
+
-**`feint` vs `print` in tests**: `feint` is a no-op with the same signature and `SideEffects::modifyExternal` as `print` — it won't be optimized out, but produces no output. Use `feint` in tests instead of `print` unless testing actual print/logging behavior
189
195
-**`push` vs `emplace` vs `push_clone`** for arrays: `push(arr, val)` copies `val` into the array (fails for non-copyable types like `array<int>`); `emplace(arr, val)`**moves**`val` into the array (source is zeroed/destroyed after); `push_clone(arr, val)`**clones**`val` into the array (works for any type, preserves source). When generating code that operates on user structs with potentially non-copyable fields, prefer `push_clone` (preserves source) or `emplace` (when source consumption is intentional).
190
196
-**Non-copyable types**: `array<T>`, `table<K;V>`, lambdas, and any struct containing them cannot be copied with `=` or `push`. Use `:=` (clone-assign), `push_clone`, or `<-` (move) instead. The compiler error is clear: "can't copy non-copyable type"
191
197
@@ -205,20 +211,14 @@ All code examples and documentation MUST use gen2 syntax (add `options gen2` at
205
211
-`include/daScript/` — C++ headers
206
212
-`daslib/` — Standard library modules (86 .das files)
207
213
-`dastest/` — Test framework
208
-
-`tests/` — Test suite (with per-module subfolders: `tests/decs/`, `tests/match/`, `tests/json/`, etc.)
214
+
-`tests/` — Test suite (35 subdirectories, ~226 `.das` files). See `tests/README.md` for a full index of every test file, what it tests, and whether it expects compile errors.
209
215
-`doc/source/reference/language/` — RST language documentation (36 files)
210
216
-`doc/source/stdlib/` — RST standard library documentation (auto-generated + handmade)
Copy file name to clipboardExpand all lines: CLAUDE.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,10 @@ Task-specific instructions are split into skill files under `skills/`. You MUST
36
36
37
37
Multiple skill files may apply to a single task. For example, creating a new daslib module requires reading `skills/das_formatting.md`, `skills/daslib_modules.md`, and possibly `skills/documentation_rst.md`.
38
38
39
+
### Updating Instructions with New Knowledge
40
+
41
+
When you discover something new about daslang syntax, semantics, or conventions — whether through compiler errors, user corrections, or experimentation — **update this file** (and its `.github/copilot-instructions.md` mirror) with the new knowledge. Add it to the appropriate section (gen2 syntax, common gotchas, etc.) so future sessions benefit. If it relates to a specific skill area, update the relevant `skills/*.md` file too.
42
+
39
43
## daslang Language — Gen2 Syntax (REQUIRED)
40
44
41
45
All code examples and documentation MUST use gen2 syntax (add `options gen2` at the top of every file). Key rules:
@@ -57,6 +61,7 @@ All code examples and documentation MUST use gen2 syntax (add `options gen2` at
57
61
-**Bitfield dot access:** read with `f.flag` (returns bool), write with `f.flag = true/false`
58
62
-**`typeinfo`** gen2 syntax: trait name goes **outside** parentheses — `typeinfo trait_name(type<T>)`, NOT `typeinfo(trait_name type<T>)`. With subtrait: `typeinfo has_method<name>(type<T>)`. With two traits: `typeinfo trait<sub;extra>(type<T>)`
59
63
-**`static_if`:**`static_if (condition) { ... }` — parentheses required in gen2
64
+
-**Type function call:**`take(type<int>, 1, 2)` — NOT `take < int > (1, 2)`. The `type<T>` is passed as a regular argument
60
65
61
66
### Important defaults
62
67
@@ -186,6 +191,7 @@ All code examples and documentation MUST use gen2 syntax (add `options gen2` at
186
191
- Blocks CANNOT be stored in containers, returned from functions, or captured — use lambdas or function pointers for those use cases
187
192
-`match`, `multi_match`, `static_match` macros (from `daslib/match.das`) handle side effects automatically — do NOT add `[sideeffects]` annotations to functions that only use match
188
193
-`[export] def main()` returns `void` — do NOT `return true` or return other values from main
194
+
-**`feint` vs `print` in tests**: `feint` is a no-op with the same signature and `SideEffects::modifyExternal` as `print` — it won't be optimized out, but produces no output. Use `feint` in tests instead of `print` unless testing actual print/logging behavior
189
195
-**`push` vs `emplace` vs `push_clone`** for arrays: `push(arr, val)` copies `val` into the array (fails for non-copyable types like `array<int>`); `emplace(arr, val)`**moves**`val` into the array (source is zeroed/destroyed after); `push_clone(arr, val)`**clones**`val` into the array (works for any type, preserves source). When generating code that operates on user structs with potentially non-copyable fields, prefer `push_clone` (preserves source) or `emplace` (when source consumption is intentional).
190
196
-**Non-copyable types**: `array<T>`, `table<K;V>`, lambdas, and any struct containing them cannot be copied with `=` or `push`. Use `:=` (clone-assign), `push_clone`, or `<-` (move) instead. The compiler error is clear: "can't copy non-copyable type"
191
197
@@ -205,20 +211,14 @@ All code examples and documentation MUST use gen2 syntax (add `options gen2` at
205
211
-`include/daScript/` — C++ headers
206
212
-`daslib/` — Standard library modules (86 .das files)
207
213
-`dastest/` — Test framework
208
-
-`tests/` — Test suite (with per-module subfolders: `tests/decs/`, `tests/match/`, `tests/json/`, etc.)
214
+
-`tests/` — Test suite (35 subdirectories, ~226 `.das` files). See `tests/README.md` for a full index of every test file, what it tests, and whether it expects compile errors.
209
215
-`doc/source/reference/language/` — RST language documentation (36 files)
210
216
-`doc/source/stdlib/` — RST standard library documentation (auto-generated + handmade)
@@ -2354,6 +2355,15 @@ Executes the application main loop by repeatedly invoking `block` until it retur
2354
2355
2355
2356
:Arguments: * **block** : block<void> implicit
2356
2357
2358
+
.. _function-builtin_feint_string:
2359
+
2360
+
.. das:function:: feint(text: string)
2361
+
2362
+
No-op replacement for `print`. Has the same signature and side-effect annotations as `print`, but intentionally does nothing. Use `feint` in tests where print-like behavior is needed to prevent the call from being optimized out, but no actual output is desired.
0 commit comments