Remix.run Logo
morcus 14 hours ago

An interesting bit to me is that it compiles to (apparently) readable C, I'm not sure how one would use that to their advantage

I am not too familiar with C - is the idea that it's easier to incrementally have some parts of your codebase in this language, with other parts being in regular C?

saidnooneever 13 hours ago | parent | next [-]

one benefit is that a lot of tooling e.g. for verification etc. is built around C.

another is that it only has C runtime requirement, so no weird runtime stuff to impelement if youd say want to run on bare metal..you could output the C code and compile it to your target.

zbendefy 14 hours ago | parent | prev [-]

i think so. The biggest hurdle with new languages is that you are cut off from a 3rdparty library ecosystem. Being compatible with C 3rd party libraries is a big win.

actionfromafar 13 hours ago | parent [-]

Makes it easy to "try before you buy", too. If you decide it's not for you, you can "step out" and keep the generated C code and go from there.

forgotpwd16 12 hours ago | parent | next [-]

This isn't a very sane plan. The ~300 LOC example mini_grep (https://github.com/z-libs/Zen-C/blob/main/examples/tools/min...) compiles to a ~3.3k LOC monstrosity (https://pastebin.com/raw/6FBSpt1z). It's easier to rewrite the whole thing than going from the generated code.

At least for now, generated code shouldn't be considered something you're ever supposed to interact with.

actionfromafar 5 hours ago | parent [-]

I looked at it primed for the worst by your comment, but it’s honestly not so bad. A lot of setup, data type code and what looks like overloads.

morcus 12 hours ago | parent | prev [-]

Very good point that I never considered! Thanks.