-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes.txt
206 lines (161 loc) · 6.01 KB
/
notes.txt
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
BUG?? src/beast/code/ast/expr/assign.d iń parse - i load operator, then run it through switch, but if the operator does not match assign stuff, it eats the operator anyway?
Diplomka to-do:
x++.staticFunction
- x++ (context) should execute?
- always execute side effects
- a.#type b ???
Offer directFunction that works over memory pointers ( Int.addDirectFunction("operatorAdd", (a,b) => a+b))
- For stuff like integer addition in interpreters (still needs fallback for other backends)
- Asi nemít natvrdo backendové funkce? (bude se líp implementovat?)
New memory mgmt system:
Beast pointer = offset in pointer table
pointer table items: struct { MemoryBlock (instance), size_t offset in the memory block }
-> no need for virtual address space structures, constant time pointer lookup
- also special case for null pointer
- allow saving memory state and reverting to it (breaks and @ctime)
- code location guard -> mixin; nepoužívat explicit stack, využít lokální proměnný (stejně jako u spousty dalších věcí)
- rework bootstrap function/member generation
- primitive functions -> rename to inline functions
- for example turn this: Symbol_PrimitiveMemberNonRuntimeFunction.paramsBuilder( ).ctArg( coreType.Type ).finish( //
( AST_Node ast, DataEntity inst, MemoryPtr targetType ) { //
into
( AST_Node ast, DataEntity inst, CTArg!( coreType.Type ) targetType ) { ... }
- auto constructor generation (call implicit ones - enough for now?)
- clean up namespaces/scopes; scopes are handled internally in backend, then we have Namespaces: StaticNamespace (once generated and then untouchable) and LocalNamespace (can be sequentially written, but only accessed from the current job)
Bool ctimeFunc( @ctime Int x ) { ... }
void main() {
@ctime Int! x;
println( x++ > 0 && ctimeFunc( x ) );
// Problem - ctimeFunc is executed during semantic tree building, so x++ is executed after
// Resolution: cannot mutate @ctime variables in nonctime code + @ctime code has to be executed immidately when building semantic tree
// - another problem: @ctime ( a + b ).#type << ( a + b ) gets executed!
// - resolution: ?????; check inner expression did not change any outer memory
}
- @ctime local variable destructors - memory rollback is necessary to implement (because of breaks and returns - we have to mirror destructor call changes and then roll it back) ...?
- zbavit se BP stacku v C++ backendu - místo toho lokální proměnnou, jejíž velikost specifikuju pozdějc
- pole
- lambda funkce (zatím stačí bez kontextu)
- Type.#instanceSize (this should return size of type Type?) vs var.#instanceSize vs SomeType.#instanceSize
- u namespaců opatřovat seznam identifikátorů, aniž by se musely instanciovat typy (pro každý identifikátor pak instanciovat zvlášť)
More to-do:
- user enums (with member functions)
- realloc
- arrays?
- Copy-on-write, session only
- @ctime while
- if in function definitions
- Decorated && expression buildStatementCode -> cleaner + cover ifs, whiles, all statements
-> @ctime has to have a statementModifier context -- resolved on a statement AST level. If not @ctime -> statement is executed in a subsession
- public/private/...
- Join template parameters - pointer-aware data compare
- Implicit cast to reference -> higher priority than implict cast to anything else
- Do not generate reference types for everything
- trycast allow explicit retyping
- Class inheritance, virtual functions, etc.
- Member functions with @ctime parameters
- @ctime functions
- user decorators?
- functions - first-class citizens
- generic classes
- imports
- $ instead of # ?
Examples - ideas:
Fibonacci
Factorial
Binary tree
Erastothenes sieve
Inferration examples -> make user enum
Flags example
string.toInt(base, ?result); -- předávání nekonstantních referencí musí předcházet otazník
Names:
Lion
Boar
Bear
Bull
Crocodile
Panther
Ocelot
Scorpion
Tiger
Wolf
Fantasy:
Dragon - compiler
Troll
Centaur
Ghoul
Basilisk
Griffin
Harpy
Hydra
Salamander
Siren
Vampire
Werewolf
Minotaur
Special:
Bestiary
More ideas:
- TRAITS : make them @trait base classes (the classes will not really exists, but everything else will work)
- Extension function - this syntax
fun String.format(): String {
return this.replace(' ', '_')
}
val formatted = str.format()
- === for reference equality; rather ?==
- ref?.member for default values for null?
BBasile (does simple editor with syntax highlight): [email protected]
-- Problem with @ctime variable destructor calls when calling break; or return; or so - they can't be actually called
- @ctime destructors would be called "last" ? Or not at all?
--
// in D (not working as virtual):
void foo( this T )() {
}
// in Beast: (or something like this)
@virtualImpl void foo() {
}
// or we can also have a function that is implemented for the first child and then is final, something like @firstChildImpl or so, also just @virtualChildImpl or so (like @virtualImpl but implements only for the first child and then gets final), also @childImpl that is like @virtualChildImpl but is not virtual (and allows @ctime parameters)
-- Reflection of comments + documentation generation
-- Ability to pass ctime string using a command line in beast
FIX!!
Void test( 5 + 4 ) {
}
Void main() {
@ctime test( 5 + 4 ); // error: 5 + 4 not ctime
}
-- What to do with
Void foo( Int!? a, @ctime Int!? b ) {
a++;
b++;
}
Void main() {
@ctime Int! x;
foo( x, x );
}
-- What to do with
class C( Int!? x ) {
Void test() {
x++; // Obviously x data must be constantiatized -- this is handled by rule "changing ctime value from rtime scope"
stdout.write( x );
}
}
Void main() {
@ctime Int! a = 0;
C( a ) c;
c.test();
a++;
c.test(); // What now? This is kinda screwed... a should be constantiatized or sumthing
}
---
class C {
@public:
@wipMutable Int x;
}
C! getC() {
@wip C! result = new @wip C();
result.x = 5;
return result;
}
void main() {
C! c = getC();
c.x = 5; // Error
}