News for hackers. Stuff that matters.
Re:XL: An Extensible Programming Language by thechao on Wednesday February 21, 2024 @09:28AM (#39454225)
I'd like C, but where I could use some syntax like:

   typedef _Load("libvector.so")(int) vector_int;
to add arbitrary "builtin" types to the language. The idea being that "libvector.so" would use some spec-defined API to extend the core C language with the new features. This would replace a slew of features in the core C++ language (templates, classes, any sort of reflection, etc.), with some sort of 3rd party dylib you load. The idea is to keep the core language simple in the sense that it doesn't contain its own extension mechanism as syntax.

I think my only worries would be how to handle life-time analysis, i.e., the moral equivalent of destructors, copy constructors, move-semantics, etc; maybe the dylib ('libvector.so', in this case) has to register stack-clean-up, copying, and move-semantics code-generation for the compiler?

Re:XL: An Extensible Programming Language by 5- on Wednesday February 21, 2024 @06:01PM (#39460851)
Re:XL: An Extensible Programming Language by thechao on Thursday February 22, 2024 @08:42AM (#39466915)
Hey, neat! However, this line of research (which I'm passingly familiar with) is about extending the grammar of the host language (for Xoc: C), along with the semantics (for Xoc: the Zeta interpreter). I think I'm interested in a slightly rotated design space: the C grammar is left alone[1]; instead, an extension of the C spec defines a specific API for (effectively) code injection; and, finally, we limit ourselves to new types and functions, possibly with non-standard sizing (`sizeof`/`alignof`/...) information.

[1] Modulo the introduction of `_Load("...")(__args__)`, and a few other function-like invocations.