3 ms·
I wish they'd kept it C-only instead of introducing C++ (plenty of runtime code generation libraries written in C). There is something to be said about interna
by metroholografix 6y ago
I wish they'd kept it C-only instead of introducing C++ (plenty of runtime code generation libraries written in C).
There is something to be said about internal consistency and for a codebase as established as this, C++ is more of a detriment than a gain.
- mouldysammich 6y agoI imagine developers as experienced as the creators of this evaluated the C options and decided C++ was in fact not more of a detriment than a gain. It has its problems but blindly being anti C++ is silly.
- metroholografix 6y agoHardly blindly. It's been a C codebase so far. Introducing C++ makes this no longer the case. This has strong implications for both development and deployment. I'm perplexed since there exist battle-tested code generation engines written in C (e.g. dynasm). Correct me if I'm wrong but it doesn't look like asmjit is anything special in that regard. I can't imagine Joe Armstrong being happy about this.
- tluyben2 6y agoHe might roll over in his grave... I do agree with you though.
- jashmatthews 6y agoDynasm depends on Lua for pre-processing into pure C. I guess you could write an Erlang version? There's a Ruby meta-assembler in Safari JavaScriptCore!
- metroholografix 6y agoDynasm can be compiled with minilua.c (a single file), which can simply be embedded into the Erlang build. https://corsix.github.io/dynasm-doc/tutorial.html https://corsix.github.io/dynasm-doc/tutorial.html
- h0l0cube 6y ago"We also considered using dynasm, but found the tooling that comes with asmjit to be better." https://github.com/erlang/otp/pull/2745#issuecomment-691482132 https://github.com/erlang/otp/pull/2745#issuecomment-6914821...
- patrec 6y agoAlready exists, written by none other than Virding himself: https://github.com/rvirding/luerl https://github.com/rvirding/luerl
- butterisgood 6y agoThey clearly thought there was some benefit to doing it with C++. I will say I generally agree with you on the consistency point. Then again I spent none of my time working on this project so I refuse to criticize the result. That would be obnoxious.
- kohtatsu 6y agoIntroducing C++ doesn't mean they have to allow every pull request to use whichever C++ features it wants to.
- pjmlp 6y agoGiven that all major C compilers are now written in C++, this is yet another prof where the world is going. Using C++ doesn't mean one needs to use everything from it, and improving C while keeping its semantics will hardly lead to anything much different from what C++ already offers.
- patrec 6y agoC++ generally compiles orders of magnitude slower, has far worse interop and platform support and makes it really easy to unwittingly add all sorts of horrendous bloat. I'd personally still rather write code in C++ than C, but I agree that Joe Armstrong would probably be horrified, and for good reasons.
- Asm2D 6y agoAsmJit was designed to be able to integrate well with C code bases. It uses C-style error handling (no exceptions) and provides easy to use API. I don't think it's a big deal to use it in a C project - there are other C projects that use AsmJit without any issues.