@@ -133,24 +133,33 @@ string[set] -> unordered_set<string>
133
133
string[set,16 ] -> unordered_set<string> // reserve 16 is possible
134
134
string[set,<] -> set<string>
135
135
string[set,>] -> set<string,greater>
136
- string[< set] -> set<string>
137
- string[> set] -> set<string,greater>
138
- string[<+set ] -> set <string>
139
- string[> set] -> set <string,greater>
136
+ string[set< ] -> set<string>
137
+ string[set> ] -> set<string,greater>
138
+ string[set<+ ] -> multiset <string>
139
+ string[set+> ] -> multiset <string,greater>
140
140
141
141
string[deque] -> deque<string>
142
142
string[heap] -> priority_queue<string>
143
143
string[list] -> list<string>
144
144
string[stack] -> stack<string>
145
145
146
146
[ // rule file myll::magic
147
+ default_defines=[debug,release,assert],
148
+
149
+ magic_this_ref=[self], // hardcoded right now
150
+ magic_this_class=[This,Self],
151
+ magic_base_ctor=[base,super],
152
+ magic_base_class=[Base,Super],
153
+ magic_base_on_multi_inherit=true , // will be the first inherited base
147
154
magic_return_val=[ret,result],
148
155
magic_param_val=other,
149
156
magic_param_ref=other,
150
157
magic_param_ptr=that,
151
- magic_uscore=true ,
158
+ magic_uscore=true , // write_only?
152
159
magic_autoindex=true ,
160
+ magic_flagsenum_zeroval=[None],
153
161
162
+ narrowing_conversion=false , // also set related C++ compiler warnings as errors to be sure
154
163
convert_decl=true ,
155
164
default_on_semicolon=true ,
156
165
support_nullptr=warning,
@@ -181,17 +190,22 @@ dynamic_cast=dynamic_cast<T>,
181
190
const_cast =const_cast <T>,
182
191
reinterpret_cast =reinterpret_cast <T>,
183
192
bit_cast=std::bit_cast<T>,
184
- narrowing_conversion=false , // also set related C++ compiler warnings as errors to be sure
185
193
]
186
194
class rule ::myll::magic {}
187
195
196
+
188
197
[ // rule file myll::retro
198
+ default_defines=[debug,release,assert],
199
+
189
200
magic_return_val=[],
190
201
magic_param_val=[],
191
202
magic_param_ref=[],
192
203
magic_param_ptr=[],
193
204
magic_uscore=false ,
194
205
magic_autoindex=false ,
206
+ magic_flagsenum_zeroval=[None],
207
+
208
+ narrowing_conversion=true ,
195
209
convert_decl=false ,
196
210
default_on_semicolon=false ,
197
211
support_nullptr=true ,
@@ -200,20 +214,22 @@ struct_default=[pub],
200
214
method_default=[],
201
215
func_default=[],
202
216
proc_default=[],
217
+
203
218
unique_pointer=std::unique_ptr<T>,
204
219
shared_pointer=std::shared_ptr<T>,
205
220
weak_pointer=std::weak_ptr<T>,
221
+
206
222
static_array=false ,
207
223
dynamic_array=false ,
208
224
static_cast =static_cast <T>,
209
225
dynamic_cast =dynamic_cast <T>,
210
226
const_cast =const_cast <T>,
211
227
reinterpret_cast =reinterpret_cast <T>,
212
228
bit_cast=std::bit_cast<T>,
213
- narrowing_conversion=true ,
214
229
]
215
230
class rule ::myll::retro {}
216
231
232
+
217
233
[ // rule file myll::madness
218
234
unique_pointer=T*,
219
235
shared_pointer=T*,
@@ -224,7 +240,7 @@ const_cast=((T)E),
224
240
reinterpret_cast =((T)E),
225
241
bit_cast=((T)E),
226
242
]
227
- class rule ::myll::madness {}
243
+ class rule ::myll::madness : rule::myll::retro {}
228
244
229
245
230
246
[virtual =encouraged]
273
289
274
290
275
291
shortcut table
276
- [final ] class => [dispatch=disallow ] if no virtual base class
277
- || [dispatch=final ] if virtual base class
292
+ [final ] class => [dispatch=final ] if base class dispatch = virtual
293
+ || [dispatch=disallow] else
278
294
[pod] class => [dispatch=disallow] => applies [dispatch=static ] func, among other things
279
295
[interface] class => [dispatch=interface]=> applies [dispatch=abstract] func
280
296
[nonvirtual]class => [dispatch=forbid]
@@ -288,15 +304,27 @@ shortcut table
288
304
[override ] func => [dispatch=override ]
289
305
[final ] func => [dispatch=final ]
290
306
291
- [manual] enum => [startcount =nil,counting =manual]
292
- [] enum => [startcount =0 , counting =increment]
307
+ [manual] enum => [init =nil, iteration =manual]
308
+ [] enum => [initval =0 , progress =increment]
293
309
[enum ] enum => [startcount=0 , counting=increment]
294
- [flags] enum => [startcount =1 , counting=doubling]
295
- [enum ] enumval => [startcount=???, counting=increment]
296
- [flags] enumval => [startcount=???, counting=doubling ]
310
+ [flags] enum => [startval =1 , counting=doubling, zeroval=@magic_flagsenum_zeroval ]
311
+ [enum ] enumval => [ counting=increment]
312
+ [flags] enumval => [ counting=shift,shifting,leftshift ]
297
313
298
314
[global] var => [storage=static ]
299
315
316
+ [noblock, something_else]
317
+ {
318
+ // if you want the containing things to apply attribute "something_else",
319
+ // but not introduce a block/scope
320
+ }
321
+
322
+ // flags also gets a None=0 by default
323
+ [flags]
324
+ enum Access { Read, Write, Exec }
325
+ // None = 0, Read = 1, Write = 2, Exec = 4
326
+ // Maybe also provide a named mask by or'ing all flags
327
+
300
328
Dr K sprach grad über seinen Guru, der sowas ist wie ein Coach...
301
329
und dann dachte ich mir ich mache sowas bei unseren neuen Codern,
302
330
vielleicht sollte ich das auch freiberufich machen.
@@ -325,6 +353,7 @@ int Blah::i = 0;
325
353
// DO NOT rely on linkage internal/hidden, since merged cpp building might copy multiple files together
326
354
// so a cpp file might have two [internal] var int x; and then fail to compile
327
355
// module linkage can fix this, so rather only use [global] and [module]
356
+ [linkage=module] should be the default
328
357
[linkage=module] var int mv; // visibility internal, but since we have merged module builds...
329
358
[linkage=module] const int mc; // visibility internal, ... (fusion of all cpp) this might work
330
359
[hidden,intern(al),NOT static ] var int hv; // visibility internal, other TU can not see this
@@ -359,10 +388,10 @@ Removed in Myll compared to C and C++
359
388
- operator ","
360
389
- operator prefix "+" ???
361
390
- typedef (use " using" instead)
362
- - non-class enums (use " class enum" instead)
363
- - directly declare an object of a newly declared type (struct B {} b;)
391
+ - unscoped enums (use " class enum" instead)
392
+ - directly declare an object of a newly declared type (e.g. struct B {} b;)
364
393
- local classes, structs, enums, and functions inside functions. (lambdas can replace local functions)
365
- - forward declarations (import what you need from other modules)
394
+ - forward declarations (order irrelevant, import what you need from other modules)
366
395
- assignment in expressions
367
396
- throw in expressions
368
397
- goto
@@ -420,3 +449,17 @@ render.DrawLine(...); // working autocompletion and 10 significant chars less to
420
449
// assuming that you did not intentionally sabotage DrawLine by making it unnecesarily virtual.
421
450
// This is not about polymorphism.
422
451
452
+
453
+ var int *? weakPtrToInt;
454
+ if (weakPtrToInt)
455
+ {
456
+ weakPtrToInt->doThings ();
457
+ }
458
+
459
+ // myll -> C++
460
+
461
+ std::weak_ptr<int > weakPtrToInt;
462
+ if (std::shared_ptr<int > weakPtrToIntLocked = weakPtrToInt.lock())
463
+ {
464
+ weakPtrToIntLocked->doThings ();
465
+ }
0 commit comments