arc-lang 0.6.11 → 0.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/interpreter.js +7 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/stdlib/MODULES.md +7 -11
- package/stdlib/README.md +1 -1
package/dist/interpreter.js
CHANGED
|
@@ -27,6 +27,13 @@ class Env {
|
|
|
27
27
|
suggestion: "Did you mean 'let mut' to declare a mutable variable?",
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
if (name === "import") {
|
|
31
|
+
throw new ArcRuntimeError(`Undefined variable: ${name}`, {
|
|
32
|
+
code: ErrorCode.UNDEFINED_VARIABLE,
|
|
33
|
+
category: "RuntimeError",
|
|
34
|
+
suggestion: "Arc uses 'use' instead of 'import'. Try: use modulename",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
30
37
|
const candidates = this.allNames();
|
|
31
38
|
const closest = findClosestMatch(name, candidates);
|
|
32
39
|
throw new ArcRuntimeError(`Undefined variable: ${name}`, {
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
package/stdlib/MODULES.md
CHANGED
|
@@ -781,21 +781,17 @@ stdlib/
|
|
|
781
781
|
└── cmd/ # Command execution
|
|
782
782
|
```
|
|
783
783
|
|
|
784
|
-
###
|
|
784
|
+
### Use Syntax
|
|
785
785
|
|
|
786
786
|
```arc
|
|
787
|
-
//
|
|
788
|
-
|
|
787
|
+
// Use entire module
|
|
788
|
+
use collections
|
|
789
789
|
|
|
790
|
-
//
|
|
791
|
-
|
|
790
|
+
// Use specific exports
|
|
791
|
+
use collections { List, Map, Set }
|
|
792
792
|
|
|
793
|
-
//
|
|
794
|
-
|
|
795
|
-
import {List as L} from collections
|
|
796
|
-
|
|
797
|
-
// Import everything (discouraged)
|
|
798
|
-
import * from collections
|
|
793
|
+
// Use everything (discouraged)
|
|
794
|
+
use collections { * }
|
|
799
795
|
```
|
|
800
796
|
|
|
801
797
|
---
|
package/stdlib/README.md
CHANGED
|
@@ -40,7 +40,7 @@ strings.capitalize("hello") # => "Hello"
|
|
|
40
40
|
strings.words("one two three") # => ["one", "two", "three"]
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
## Built-in Functions (No
|
|
43
|
+
## Built-in Functions (No `use` Required)
|
|
44
44
|
|
|
45
45
|
Many common operations are built into Arc and need no `use` statement:
|
|
46
46
|
|