Add TextWriter, IOException, per-VM module data and pre-load imports; Add console module with Console class

This commit is contained in:
2026-11-23 18:36:46 +01:00
parent 2243557bf5
commit 4d06edd045
55 changed files with 1679 additions and 675 deletions
+8 -5
View File
@@ -1,3 +1,4 @@
import 'console';
class Program {
string[] testArray() {
@@ -5,16 +6,18 @@ class Program {
}
callback[] testCallback() {
return {'callme' => void() { print("Hello world\n"); }};
return {'callme' => void() { Console::Print("Hello world\n"); }};
}
public void main() {
callback[] $constr = {'print'};
print($this->testArray()['Machine'] + "\n");
callback[] $constr = { void(string $s) { Console::Print($s); } };
Console::Print($this->testArray()['Machine'] + "\n");
$this->testCallback()['callme']();
print(true ? "TRUE\n" : false ? "true\n" : "false\n");
(void(string $name) { print("This should work too - $name.\n");})('AerScript');
Console::Print(true ? "TRUE\n" : false ? "true\n" : "false\n");
(void(string $name) { Console::Print("This should work too - $name.\n");})('AerScript');
$constr[0]('Test finished.' + "\n");
callback[] $map = {'up' => 'strtoupper', 'low' => 'strtolower'};
Console::Print("%s|%s\n", $map['up']("UPPER/lower"), $map['low']("UPPER/lower"));
}
}