deemphasize a concern

[?]
Apr 16, 2023, 5:37 PM
7MOX7PIKINJ5JE2HPCY5RGRE553MM4ZAQGT4JFYS2PSDA6XAZDVAC

Dependencies

  • [2] QFFTXR7E new file-system format for freewheeling apps
  • [3] TNRO6KLZ new live app
  • [4] UUX7J2OA prevent overriding foundational definitions
  • [5] SEJ76JDA keep templates in sync
  • [*] JIWWTY7R extract a function

Change contents

  • edit in main.lua at line 49
    [3.45][3.46:1198]()
    end
    -- Everything that exists before we start loading the live files is frozen and
    -- can't be edited live.
    function app.freeze_all_existing_definitions()
    app.Frozen_definitions = {on=true} -- special case for version 1
    local done = {}
    done[app.Frozen_definitions]=true
    app.freeze_all_existing_definitions_in(_G, {}, done)
    end
    function app.freeze_all_existing_definitions_in(tab, scopes, done)
    -- track duplicates to avoid cycles like _G._G, _G._G._G, etc.
    if done[tab] then return end
    done[tab] = true
    for name,binding in pairs(tab) do
    local full_name = app.full_name(scopes, name)
    --? print(full_name)
    app.Frozen_definitions[full_name] = true
    if type(binding) == 'table' and full_name ~= 'package' then -- var 'package' contains copies of all modules, but not the best name; rely on people to not modify package.loaded.io.open, etc.
    table.insert(scopes, name)
    app.freeze_all_existing_definitions_in(binding, scopes, done)
    table.remove(scopes)
    end
    end
    end
    function app.full_name(scopes, name)
    local ns = table.concat(scopes, '.')
    if #ns == 0 then return name end
    return ns..'.'..name
  • edit in main.lua at line 225
    [3.7614]
    [7.27]
    end
    -- Everything that exists before we start loading the live files is frozen and
    -- can't be edited live.
    function app.freeze_all_existing_definitions()
    app.Frozen_definitions = {on=true} -- special case for version 1
    local done = {}
    done[app.Frozen_definitions]=true
    app.freeze_all_existing_definitions_in(_G, {}, done)
  • edit in main.lua at line 236
    [7.32]
    [2.2793]
    function app.freeze_all_existing_definitions_in(tab, scopes, done)
    -- track duplicates to avoid cycles like _G._G, _G._G._G, etc.
    if done[tab] then return end
    done[tab] = true
    for name,binding in pairs(tab) do
    local full_name = app.full_name(scopes, name)
    --? print(full_name)
    app.Frozen_definitions[full_name] = true
    if type(binding) == 'table' and full_name ~= 'package' then -- var 'package' contains copies of all modules, but not the best name; rely on people to not modify package.loaded.io.open, etc.
    table.insert(scopes, name)
    app.freeze_all_existing_definitions_in(binding, scopes, done)
    table.remove(scopes)
    end
    end
    end
    function app.full_name(scopes, name)
    local ns = table.concat(scopes, '.')
    if #ns == 0 then return name end
    return ns..'.'..name
    end