summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-06-08 14:42:36 -0400
committerGitHub <noreply@github.com>2023-06-08 14:42:36 -0400
commitc492288b4778b19bd66ac31edb076add096e757d (patch)
treeaff46ec99ffabcf50983b24ba8c7be91c05799cd
parent7726fa351e99249b1e42f72e6b3a7a16cc708bfc (diff)
Attempt to fix doc generation issue (#2922)
* #include an absolute path didn't work - because paths were taken to always be relative. * Small fixes and improvements around reflection tool. * Make PrettyWriter printing a class. * Change the std intrinsics example, so that building docs works.
-rw-r--r--docs/design/stdlib-intrinsics.md29
1 files changed, 7 insertions, 22 deletions
diff --git a/docs/design/stdlib-intrinsics.md b/docs/design/stdlib-intrinsics.md
index 4ae23e2eb..0aaa99057 100644
--- a/docs/design/stdlib-intrinsics.md
+++ b/docs/design/stdlib-intrinsics.md
@@ -25,33 +25,18 @@ The `.meta.slang` files look largely like Slang source files, but their contents
As an example, to produce an an array with values 0 to 9 we could write...
-```text
+```slang
// Slang code
-int a[] = {
-
-${{{{
-// C++ code
-for (int i = 0; i < 10; ++i) {
-}}}}
-
-// Slang code that will be emitted for each iteration of the loop.
-// $(i) will be replaced by the value of i for the loop
-$(i),
-
${{{{
-// C++ code closing { for the loop
-}
+// C++ code, calling out to a C++ function getTime, the result is held in variable time
+int cppTime = getTime();
}}}}
-// Slang code closing the end of the array
-};
-```
-
-Will produce something like
-
-```slang
-int a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+// Back to Slang code, can access the C++ variable previously defined as cppTime. Due to $().
+// The code inside the $() is executed on the C++ side, so can do calculations. In practice it would be easier
+// to just use call $(getTime() + 1), but this demonstrates variables are accessible.
+int slangTime = $(cppTime + 1);
```
# Attributes