Skip to content

Commit c9ac9b4

Browse files
committed
fix: update data types in function definitions and improve documentation clarity
1 parent 72fbc9f commit c9ac9b4

10 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎content/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ print(1 + 2)
8585

8686
| 이름 | 값 |
8787
|---|---|
88-
| `{{engine.dlcCount}}` / `{{engine.dlcNames}}` | 내장 라이브러리 개수 / 이름 목록 (`math/string/...`) |
88+
| `{{engine.dlcCount}}` / `{{engine.dlcNames}}` | 내장 라이브러리 개수 / 이름 목록 (`math, string, ...`) |
8989
| `{{engine.functionCount}}` / `{{engine.errorCodeCount}}` | 내장 함수 / 에러 코드 개수 |
9090
| `{{error.에러이름}}` | 엔진이 출력하는 에러 코드 (예: `{{error.DivisionByZero}}` → 코드). 글에 번호를 직접 적지 마세요. |
9191
| `{{examples.count}}` | IDE 예제 개수 |

‎content/guide/02-syntax.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ When a block's body and its `end` fit on the header's line, no indentation is ne
2020
```cuff
2121
number x = 10
2222
if x is 10 do: print("ten") end
23-
func twice(any n) do: return n * 2 end
23+
func twice(number n) do: return n * 2 end
2424
print(twice(x))
2525
```
2626

@@ -124,12 +124,12 @@ A constant is declared with `constant [type] [name] = [value]`. Its name must be
124124

125125
```cuff
126126
constant number MAX_RETRIES = 3
127-
constant str API_URL = "https://cufflang.dev"
127+
constant str API_URL = "https://cuffscript.pages.dev"
128128
print(MAX_RETRIES, API_URL)
129129
```
130130

131131
```output
132-
3 https://cufflang.dev
132+
3 https://cuffscript.pages.dev
133133
```
134134

135135
```cuff error=InvalidConstantName

‎content/guide/04-functions.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ summary: Declaring and calling functions, parameters, scope and global, pure and
88
A function is a named block of code that you can run again and again. It starts with `func`, lists its parameters in parentheses, opens its body with `do:` and ends with `end`. A short function fits on one line, as in `func twice(number x) do: return x * 2 end`. A call is the function's name followed by arguments in parentheses, either as a statement on its own line or as part of an expression; a call never uses `do:`.
99

1010
```cuff
11-
func greet(any name) do:
11+
func greet(str name) do:
1212
print(f"Hello, {name}!")
1313
end
1414
15-
func fib(any n) do:
15+
func fib(number n) do:
1616
if n <= 1 do:
1717
return n
1818
end
@@ -38,7 +38,7 @@ These are the rules for declaring and calling:
3838

3939
```cuff
4040
print(double(21))
41-
func double(any x) do: return x * 2 end
41+
func double(number x) do: return x * 2 end
4242
```
4343

4444
```output
@@ -155,11 +155,11 @@ Put `pure` in front of `func` to promise that a function does not touch the outs
155155
```cuff
156156
number shared_state = 0
157157
158-
pure func double(any x) do:
158+
pure func double(number x) do:
159159
return x * 2
160160
end
161161
162-
pure func quad(any x) do:
162+
pure func quad(number x) do:
163163
return double(double(x)) note: a pure function calling a pure one is fine
164164
end
165165
print(quad(5)) note: 20

‎content/guide/08-modules.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A long program is easier to read when it is split into files. `use name from ./f
1010
```cuff
1111
note: lib/greetings.cuff
1212
constant str DEFAULT_GREETING = "Hello"
13-
func greet(any name) do:
13+
func greet(str name) do:
1414
global DEFAULT_GREETING
1515
return DEFAULT_GREETING + ", " + name + "!"
1616
end

‎content/home/00-hero.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: CuffScript
44
slogan: “As easy as a game, as light as a feather, and as fast as a flash.”
55
---
66

7-
CuffScript is a language built less to perfect any one piece of syntax than to make programming itself feel less intimidating. There is nothing to install or configure: you can run your first line right here on this page.
7+
CuffScript is a language built less to perfect any one piece of syntax than to make programming itself feel less intimidating. There is nothing to install or configure: open the IDE and you can run your first line in your browser within a few seconds.
88

99
<div class="home-cta">
1010
<a class="btn btn-primary" href="/ide/">

‎content/home/50-example.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A recursive Fibonacci example.
88
:::
99

1010
```cuff
11-
func fib(any n) do:
11+
func fib(number n) do:
1212
if n <= 1 do: return n end
1313
return fib(n - 1) + fib(n - 2)
1414
end

‎content/home/65-faq.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Yes. The engine is a library: use the `cuffscript-wasm` package from JavaScript
5959

6060
### Is it safe to run a program I did not write?
6161

62-
CuffScript is built so that a program can do only what its host allows. File access is confined to one folder and cannot escape it with `..` or links, network requests to local and private addresses are blocked, and an execution budget stops runaway loops. In the browser IDE the file library is blocked and the browser stops raw network access. Treat these as protections and not as a guarantee, and read the project's security policy before you rely on them for untrusted code.
62+
CuffScript is built so that a program can do only what its host allows. File access is confined to one folder and cannot escape it with `..` or links, network requests to local and private addresses are blocked, and an execution budget stops runaway loops. In the browser IDE the file library is blocked and the browser stops raw network access. Treat these as protections and not as a guarantee, and read the project's [security policy]({{site.blobUrl}}/SECURITY.md) before you rely on them for untrusted code.
6363

6464
### Is it free to use?
6565

‎package-lock.json‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/lib/content.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function buildVars(ctx, extra = {}) {
8484
"site.changelogUrl": urls.changelogUrl,
8585
"engine.version": ctx.meta.engineVersion,
8686
"engine.dlcCount": names.length,
87-
"engine.dlcNames": names.join("/"),
87+
"engine.dlcNames": names.join(", "),
8888
// every reserved word, as inline code (the literals true/false are reserved too)
8989
"engine.keywords": [...ctx.meta.keywords, ...ctx.meta.literals.filter((w) => w !== "empty")].map((w) => `\`${w}\``).join(", "),
9090
"engine.keywordCount": ctx.meta.keywords.length + ctx.meta.literals.filter((w) => w !== "empty").length,

‎scripts/test/content.test.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ test("home: the docs grid is derived from the guide and every link lands on a re
105105
test("home: counts shown in the text come from the real data, not from memory", () => {
106106
const tour = home.cardsHtml;
107107
assert.ok(tour.includes(`${Object.keys(ctx.meta.dlc).length} libraries`), "DLC count");
108-
assert.ok(tour.includes(Object.keys(ctx.meta.dlc).join("/")), "DLC list");
108+
assert.ok(tour.includes(Object.keys(ctx.meta.dlc).join(", ")), "DLC list");
109109
const exampleCount = fs.readdirSync(path.join(root, "src/examples")).filter((n) => /^\d+_/.test(n)).length;
110110
assert.ok(tour.includes(`${exampleCount} ready-made examples`), "example count");
111111
});

0 commit comments

Comments
 (0)