4 ms·
PyObject graphs that represent dynamic variables through pseudo OOP legacy C code. Check it out, it's a total nightmare of downcasting pointers. It amazes me in
by mastrsushi 6y ago
PyObject graphs that represent dynamic variables through pseudo OOP legacy C code. Check it out, it's a total nightmare of downcasting pointers. It amazes me in the 29+ years it hasn't been replaced by a C++ alternative that could retain compatability.
I think AST interpreted languages are becoming something of the past. Yes I'm aware there's bytecode in CPython. I like the idea of IL's as target platforms rather than 100 leaky interpreters that you have to manually bind your C code with if you want support ti support any one of them.
- jashmatthews 6y agoTruffle is built around AST interpretation so that’s not going to happen any time soon.
- jnwatson 6y agoThis is extraordinarily normal C code. I’ve worked with several large code bases that look like CPython code. Heck, a lot of Linux looks like that. It really speaks more to the failure of C++ than anything about CPython. C++ is so much more than C with objects, and all that extra is what folks don’t want.
- mastrsushi 6y agoI never understood the argument of C++ being too big of a language. Code bases can enforce restrictions on what can be used.
- stinos 6y agoCan you give a practical example of how a codebase can prevent restrict typical 'here's a bazooka to shoot yourself in the foot' C++ code?
- gjvc 6y ago> This is extraordinarily normal C code. I’ve worked with several large code bases that look like CPython code. Heck, a lot of Linux looks like that. Manually-implemented dispatch / vtbls you mean?
- steerablesafe 6y agoYes, a lot of C libraries reinvent dynamic dispatch with vtables or some other way. Sometimes they reinvent exceptions as well with longjmp.
- gjvc 6y agoWell then, I agree with jnwatson.
- enriquto 6y ago> reinvent exceptions as well with longjmp. What a bizarre way to phrase it. Shouldn't it be the other way round? Exceptions are just a "reinvention" of longjmp under a different name (yet identically noxious to program readability).
- richardwhiuk 6y agoExceptions are a programming flow control concept. longjump is a specific family of processor op codes. This is the same idea that while loops are implemented using goto.
- miohtama 6y agoOther C vtable implementations - GTK (Gnome / GIMP) - COM (Windows - though it is more intervined with C++) - Quake / Doom and other old game engines though nobody uses C anymore today
- tom_mellior 6y ago> I think AST interpreted languages are becoming something of the past. Yes I'm aware there's bytecode in CPython. Then why are you mentioning AST interpreters? Python is not an AST interpreter.
- mastrsushi 6y agoYeah I didn't realize that. What I should've said was language specific run-time environments are becoming something of the past.