/
TODO
234 lines (159 loc) · 3.42 KB
/
TODO
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
Requests:
- String interpolation "asadasdsa {} {1}" % (asdasd)
- Expression in string "asdas {1 + 2}"
- Multi-line strings
- tuples vs lists: (asda,vasdas,vadasd)
- Modules in multiple files
- Support module.submodule
- Importing modules (automatic resolution)
- 'elif' in conditionals
- Streamlined mappings: _ :: connector Project fold :: {_| (group[_ discipline [-1]] ?= []) push (_)}
- Filter VALUE :<: PREDICATE
- Map VALUE :=: EXTRACTOR
- Reduce VALUE :|: EXTRACTOR
- Time units 10s 10ms 10m 10h, etc
- Infix functions @infix @function fold XXXX fold XXXX -> fold (XXX,XXX)
- list comprehensions: [x * 2 for x in COLLECTION if CONDITION]
- generators
Language Features:
- Support overloading based on type
- Add standard library
- '@special' support for specila operations
- Multile-line strings/embedding of raw content
- Passing named arguments
- Casting
> ((List)asas) length()
- More operations for if:
> if self._views.main is undefined:
> return
> end
> ==, !=, <=, >=, <, >, "and", "or", "is", "not"
with (value | assignation | declaration)
DotValue *
end
String interpolation
"{0:d} {1:d}" (uses the local scope)
"{0:d} {1:d}" % {dict}
Hex/Bit notation:
0xFF
0b011010101
Bit-logic operator
&&
||
!
Infix operator:
e ~map extractor
would be rewritten as
map (e, extractor)
Automatic variables
_ == arguments[0]
_0 == arguments[0]
_1 == arguments[1]
_2 == arguments[2]
Like operation
v like (_, _, _)
like takes a structural expression that will tell if the left-hand value
is "like" the right hand value
Select/match:
match value as f
case 1.0
code
case f like (_, _, _)
code
else
code
Use map/filter/... operators:
# TODO: Could be re-expressed with lambdas with implicit parameters and operators
# ::= map
# ::< filter
# ::| reduce
# in find
# len(selection) != len(previous_selection) or len(selection ::= _ in previous_selection ::< {_ == -1})required
Assert/pre/post/error
@pre expresssion error message
@post expression error message
assert expression error message
Dictionary setdefault/assign if not null
a[1] ?= 1.0
equals to
if not isDefined(a[1]) -> a[1] = 1.0
Support continue/break
for a,b in 0..10
if a == 5
continue
elif a > 7
break
end
end
Support generators (that might not be easy)
var f = {
for a in 0..100
yield a
end
}
Add special variables
__scope_name__ (ex: widgets.Widget.ensure)
__scope__
__module__
__module_name__
__class__
__class_name__
__method__
__method_name__
__function__
__function_name__
__class__
__class_name__
__line__
__file__
and so in code
error ("{__scope_name__:__line}: Error message")
Support @singleton
Add chaining:
value:
a ()
b ()
is equal to
value a ()
value b ()
and you can also affect that
var r = value:
a ()
b ()
and chain it
var r = value:
a ()
b () :
c ()
which equals to
var _ = value () a () b ()
var r = _ c ()
Add default/named arguments:
@function i a=0, b=1, c=2
@end
@function i a, b, rest...
@end
@function i a, b, rest..., options=...
@end
@function i a, b, rest..., options=...
@end
Implicit return
{_| _ + 1}
Macros:
> @macro name( a, b, c )
> $a = pouet
> $b = pouet
> $c = pouet
> @end
>
> @function f
> @name(a,b,c)
> @end
>
> will produce the code $a, $b, $c
>
> @function f
> a = pouet
> b = pouet
> c = pouet
> @end