blob: 2ef7aa07ef8014afd61c59cfc1fcc118046d2c95 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
(.require
[library
[lux (.except local)
["@" target]
[data
[text
["%" \\format (.only format)]]]
[meta
["[0]" version]]]]
["[0]" ////
["[1][0]" generation]
["//[1]" ///
["[0]" phase (.use "[1]#[0]" monad)]
["[0]" reference (.only Reference)
["[0]" variable (.only Register Variable)]]
[meta
[archive (.only Archive)
["[0]" unit]]]]])
... This universe constant is for languages where one can't just turn all compiled definitions
... into the local variables of some scoping function.
(def .public universe
(for @.lua
... In the case of Lua, there is a limit of 200 locals in a function's scope.
(not ("lua script universe"))
@.ruby
... Cannot make all definitions be local variables because of limitations with JRuby.
(not ("ruby script universe"))
@.php
... Cannot make all definitions be local variables because of limitations with PHP itself.
(not ("php script universe"))
@.scheme
... Cannot make all definitions be local variables because of limitations with Kawa.
(not ("scheme script universe"))
#0))
(def universe_label
Text
(with_expansions [<label> (format "u" (%.nat (if ..universe 1 0)))]
(for @.lua <label>
@.ruby <label>
@.php <label>
@.scheme <label>
"")))
(def .public (artifact [module artifact])
(-> unit.ID Text)
(format "l" (%.nat version.latest)
..universe_label
"m" (%.nat module)
"a" (%.nat artifact)))
(type .public (System expression)
(Interface
(is (-> Text expression)
constant')
(is (-> Text expression)
variable')))
(def .public (constant system archive name)
(All (_ anchor expression directive)
(-> (System expression) Archive Symbol
(////generation.Operation anchor expression directive expression)))
(phase#each (|>> ..artifact (at system constant'))
(////generation.remember archive name)))
(with_template [<sigil> <name>]
[(def .public (<name> system)
(All (_ expression)
(-> (System expression)
(-> Register expression)))
(|>> %.nat (format <sigil>) (at system variable')))]
["f" foreign]
["l" local]
)
(def .public (variable system variable)
(All (_ expression)
(-> (System expression) Variable expression))
(case variable
{variable.#Local register}
(..local system register)
{variable.#Foreign register}
(..foreign system register)))
(def .public (reference system archive reference)
(All (_ anchor expression directive)
(-> (System expression) Archive Reference (////generation.Operation anchor expression directive expression)))
(case reference
{reference.#Constant value}
(..constant system archive value)
{reference.#Variable value}
(phase#in (..variable system value))))
|