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
class Foo {
init(x:int) {
self.x = x
}
}
f = Foo(42) # Works
Foo("hello") # SyntaxError: argument 'x' has the wrong type
Supported Type Annotations
Annotation
Matches
int, integer
VALUE_INTEGER
float, double, number
VALUE_FLOAT, VALUE_INTEGER
string, str
VALUE_STRING
bool, boolean
VALUE_BOOL
list
VALUE_LIST
map, dict
VALUE_DICT
null
VALUE_NULL
any (default)
Everything
type1|type2
Union of types
Class Parity Status
Feature
Functions
Methods
Parity?
Parameter types
Yes
Yes
EQUAL
Union types
Yes
Yes
EQUAL
Nullable types
Yes
Yes
EQUAL
Type error messages
Yes
Yes
EQUAL
Return type annotations
Not implemented
Not implemented
EQUAL (both missing)
Field declarations (var x:int)
N/A
Not implemented
N/A
Assignment type validation
Not implemented
Not implemented
EQUAL (both missing)
Conclusion: Functions and methods share the exact same type infrastructure. The only missing features (return types, field declarations, assignment validation) are new language features that affect both equally.
2. Stdlib Isolation Status
Architecture
User Code
↓ (can call)
Public Stdlib API (run, capture, cwd, chdir, exists)
↓ (can call)
Internal sys_* Functions (sys_run, sys_capture, sys_cwd, ...)
↓ (can call)
C Runtime (system(), popen(), getcwd(), chdir())
Security Boundary
Test
Result
sys_http_get("url") from user code
BLOCKED (SyntaxError: unknown function)
sys_cwd() from user code
BLOCKED
sys_run("cmd") from user code
BLOCKED
sys_capture("cmd") from user code
BLOCKED
from "stdlib/os.qs" import run
WORKS
run("echo hi") via stdlib
WORKS
from "stdlib/time.qs" import now
WORKS
now() via stdlib
WORKS
Implementation
g_module_mode flag: Set to 1 during import_from_module(), cleared after
g_native_access_depth: Set to 1 when calling functions from stdlib-defined code