Closed tylov closed 3 years ago
Thank you for your feedback!
1) You mean using the *99
macros in README.md
or turn on DATATYPE99_NO_ALIASES
by default?
4) I think expr99
is more a subject of such libraries as https://github.com/ramdeoshubham/macros than of Datatype99.
5) Indeed, I named this project Datatype99 because of the name of its main macro, datatype99
(which is, in turn, originated from Haskell), and what's more, I'm planning to add record types so this library would rather be described as "Algebraic data types for C99".
6) Nice catch, fixed.
I'll try Datatype99 on TinyC and answer the rest of questions bit later.
You're welcome. 1. Yes I meant e.g. users must define DATATYPE99_ALIASES if they want the short names.
TinyCC seems not to work at all with Metalang99. I think this is the cause:
#define CALL(f, ...) f(__VA_ARGS__)
#define CONST() 123
// error: macro 'CONST' used with too many args
CALL(CONST, )
But CONST()
works as expected. I've sent them a bug report.
Yes, that's a bug. It does not work with CALL(CONST) either. #define CONST(...) 123 is a workaround for now. Thanks for reporting.
Datatype99 now must work on TCC. Compilation times on GCC/TCC are almost the same:
$ time gcc examples/binary_tree.c -Imetalang99/include -I. -ftrack-macro-expansion=0
real 0m0,120s
user 0m0,103s
sys 0m0,015s
$ time tcc examples/binary_tree.c -Imetalang99/include -I.
real 0m0,131s
user 0m0,122s
sys 0m0,000s
Regarding the 99
prefix: currently, it's not possible because Datatype99 is already 1.x.y according to semver, and the change is breaking.
Thanks again for reporting.
This project has great potentials. I have a few practical suggestion for use as an external library:
#define expr99(Expr, expr) ((Expr *)(Expr[]){expr})
could maybe be part of the lib.sumtype99
.The ast.c example can be easier to read by using infix instead of prefix syntax: