var behaves like let

This commit is contained in:
2025-12-29 00:37:26 -06:00
parent 3b53a9dcc3
commit 4f3e2819fe
6 changed files with 149 additions and 106 deletions

View File

@@ -7,6 +7,7 @@ var SYSYM = '__SYSTEM__'
var hidden = _cell.hidden
var os = hidden.os;
_cell.os = null
var dylib_ext
@@ -412,6 +413,8 @@ globalThis.parallel = pronto.parallel
globalThis.race = pronto.race
globalThis.sequence = pronto.sequence
$_.time_limit = function(requestor, seconds)
{
if (!pronto.is_requestor(requestor))
@@ -486,6 +489,8 @@ _cell.config = config
ENETSERVICE = config.net_service
REPLYTIMEOUT = config.reply_timeout
/*
When handling a message, the message appears like this:
{
@@ -516,8 +521,6 @@ function guid(bits = 256)
return text(guid,'h')
}
var _Symbol = Symbol
var HEADER = _Symbol()
// takes a function input value that will eventually be called with the current time in number form.
@@ -891,12 +894,13 @@ function handle_actor_disconnect(id) {
function handle_sysym(msg)
{
var from
switch(msg.kind) {
case 'stop':
disrupt("got stop message")
break
case 'underling':
var from = msg.from
from = msg.from
var greeter = greeters[from[ACTORDATA].id]
if (greeter) greeter(msg.message)
if (msg.message.type == 'disrupt')
@@ -911,7 +915,7 @@ function handle_sysym(msg)
} else throw new Error('Got a contact message, but no portal is established.')
break
case 'couple': // from must be notified when we die
var from = msg.from
from = msg.from
underlings.add(from[ACTORDATA].id)
log.system(`actor ${from} is coupled to me`)
break
@@ -977,7 +981,6 @@ if (!locator)
// Hide JavaScript built-ins - make them inaccessible
// Store references we need internally before deleting
var _Object = Object
var _Array = Array
var _String = String
var _Number = Number
@@ -1046,7 +1049,7 @@ $_.clock(_ => {
// Get capabilities for the main program
var file_info = shop.file_info ? shop.file_info(locator.path) : null
var inject = shop.script_inject_for ? shop.script_inject_for(file_info) : []
// Build values array for injection
var vals = []
for (var i = 0; i < inject.length; i++) {
@@ -1055,15 +1058,15 @@ $_.clock(_ => {
if (key == 'fd') vals.push(fd)
else vals.push($_[key])
}
// Create use function bound to the program's package
var pkg = file_info ? file_info.package : null
var use_fn = function(path) { return shop.use(path, pkg) }
// Call with signature: setup_module(args, use, ...capabilities)
// The script wrapper builds $_ from the injected capabilities for backward compatibility
var val = locator.symbol.call(null, _cell.args.arg, use_fn, ...vals)
if (val)
throw new Error('Program must not return anything');
})