Mercurial Hosting > luan
comparison src/luan/modules/Boot.luan @ 1578:c922446f53aa
immutable threading
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 08 Feb 2021 14:16:19 -0700 |
parents | 81288d8b20a2 |
children | 2975c932864d |
comparison
equal
deleted
inserted
replaced
1577:60e5c324adf9 | 1578:c922446f53aa |
---|---|
12 local matches = StringLuan.matches -- String.matches | 12 local matches = StringLuan.matches -- String.matches |
13 local IoLuan = require "java:luan.modules.IoLuan" | 13 local IoLuan = require "java:luan.modules.IoLuan" |
14 local LuanUrl = require "java:luan.modules.url.LuanUrl" | 14 local LuanUrl = require "java:luan.modules.url.LuanUrl" |
15 local LuanJava = require "java:luan.Luan" | 15 local LuanJava = require "java:luan.Luan" |
16 local LuanTable = require "java:luan.LuanTable" | 16 local LuanTable = require "java:luan.LuanTable" |
17 local get_local_cloned = BasicLuan.get_local_cloned | |
18 local set_local_cloned = BasicLuan.set_local_cloned | |
19 local is_immutable = BasicLuan.is_immutable | |
20 local raw_set = BasicLuan.raw_set | |
17 | 21 |
18 | 22 |
19 local Boot = {} | 23 local Boot = {} |
20 | 24 |
21 | 25 |
34 security and LuanJava.setSecurity(security) | 38 security and LuanJava.setSecurity(security) |
35 end | 39 end |
36 end | 40 end |
37 end | 41 end |
38 Boot.no_security = no_security | 42 Boot.no_security = no_security |
43 | |
44 | |
45 local local_metatable = { | |
46 __index = get_local_cloned | |
47 } | |
48 function local_metatable.__new_index(tbl,key,value) | |
49 if is_immutable(tbl) then | |
50 set_local_cloned(tbl,key,value) | |
51 else | |
52 raw_set(tbl,key,value) | |
53 end | |
54 end | |
55 Boot.local_metatable = local_metatable | |
39 | 56 |
40 | 57 |
41 local function new_LuanIn(io) | 58 local function new_LuanIn(io) |
42 local this = {} | 59 local this = {} |
43 this.java = io | 60 this.java = io |
85 | 102 |
86 return this | 103 return this |
87 end | 104 end |
88 | 105 |
89 local schemes = {} | 106 local schemes = {} |
107 set_metatable(schemes,local_metatable) | |
90 --LuanTable.setSecurity(schemes,"schemes") | 108 --LuanTable.setSecurity(schemes,"schemes") |
91 | 109 |
92 function schemes.null(path) | 110 function schemes.null(path) |
93 return new_LuanIO( IoLuan.nullIO ) | 111 return new_LuanIO( IoLuan.nullIO ) |
94 end | 112 end |