Being implemented in Java and being able to run Ja...
# linking-together
m
Being implemented in Java and being able to run Java gives Java on Truffle a very interesting property: it can run itself. Indeed, Java on Truffle is a metacircular VM, it can run itself several levels deep (albeit slower and slower every time) https://medium.com/graalvm/java-on-truffle-going-fully-metacircular-215531e3f840
๐Ÿ‘ 2
k
What does metacircularity buy you?
j
I think one of the claimed advantages is the compiler is easier to extend and maintain since itโ€™s now in a safe / managed, higher level language (Java instead of C++).
e
it should probably allow to run things in a controlled way (restricting APIs and O/S calls for instance). I assume it could run a JAR disabling, say, disk access or timing out execution
it should also make it easier to eval and reload code
d
Right. I think a major "buy" for metacircular execution, is when it can actually be circular.
k
@Dan Cook I think by "actually" circular you mean that in practice each version is built by the previous version. That way you end up with the "trusting trust" problem. So to avoid turning into C, I think you often want a non-circular solution as well that you continue to maintain. Which puts some pressure on the benefits. Metacircularity is still often a good idea, but not self-evidently so. So I really wish posts like this would start by articulating their goals and why metacircularity makes sense for them.
d
I think many programmers have the (correct) intuition that some kind of circular bootstrapping will unlock or manifest some deep or profound power, but unfortunately can't substantiate why this is. So metacircularity is either dismissed as pointless, or recognized as automatically profound and powerful, regardless whether it's leveraged in any meaningfully powerful way. The powerful idea behind metacircularity (which often sensed but rarely realized) is that we can potentially leverage all the power of programming, to leverage all the power of programming. Software can be is its own lever. But this is not what you see in most "metacircular" software. It's usually more like using a robot-arm to control another identical robot-arm, versus using the arm on itself (e.g. to give itself new or improved capabilities). Less like a living cell, which contains (and thus "is") all its own apparatus for defining / executing / replicating itself; and more like a virus, which does not. (That's the link I see between "living structure", "unfolding wholeness", and what I called "actual circular" metacircularity). An example of what I think this would look like, is software that is actually written (and subsequently interpreted or created from) within itself.
k
That's way out of my expertise to argue with ๐Ÿ™‚ Both the bio and CA angles. Though I'd weakly claim that CA's notion of living order includes the environment, particularly people. It feels tenuous to connect it to metacircularity. Is any software metacircular by your definition? Smalltalk?
d
I'd say things like SmallTalk, Forth, Lisp, Glamorous Toolkit, come the closest. The gaps are in whether it's actually used that way (e.g. treating arches like bricks and building a pyramid out of them); or that it's still forced through artificial layers (like "language") that are taken as a given, but which are actually just one of a million possible "interfaces", any of which could be self-contained. MPS has the right idea, except that it provides a plethora or set-in-stone concepts, interfaces, layers, and languages for everything -- which I find highly ironic, given what is supposed to be. Racket gets an honorable mention for being the best "make your own language, in your own language" language; but it's very linear, and forced through the very specific paradigm of specifying, creating, etc etc, all through parsing textual language. Zero progress at escaping that, but it does it WELL. Actually, Rebol / Red may do it better in some (but not all) respects. It's parsing util(s) treats not only the thing being parsed as a datastructure, but also the code doing the parsing! I think it's just called "parse", and there's a write-up about this that's google-able. The principles of the moldable objects initiative (or whatever it's called) that @J. Ryan Stinnett is part of, are actually pretty in line with this stuff. I don't think it's prescriptive of what I'm talking about here, alright I think the goals overlap.
I do think that "living structure" (Purpose) is the thing one is after (consciously or not), in seeking metacircularity (Mechanism); and vice versa, that metacircularity (as I've described it) is necessarily how "living structure" (e.g. organism, business, or software extension of human capability) is achieved or constituted. Mechanism: The living thing necessarily contains it's own code (or other self-representation -- DNA is code), interpreter(s), replication, ability to replace it's bits while preserving structure & identity, and all this is self-contained, ergo the living thing "is" / "does" these things / "has" these capabilities. Purpose: Capable of adapting, changing, preserving, etc, in a way that dynamically keeps it fit for it's purpose or environment, evolving / learning all the while. Conversely, a thing that must be painstakingly redesigned and/or thrown out once it is no longer fit (if it was even a good fit at all) for some very specific (perhaps very static) purpose it was rigorously designed for, is in essence "dead" at creation. Environment does control a metacircular software thing, because that's the whole point. A car "that can do anything" really means that YOU can MAKE IT do anything (for whatever "do anything" means). That is how it can be perfectly fit and adaptable, because it provides a means to adapt "itself", including (by definition of being "fully" metacircular) those means it provides to do so.