Image System
What Is the Juvix Image System
The definition for Image can be found in the terminology section. As for the image system itself, it is the way we are able to talk about Juvix in Juvix. It allows us primitives in Juvix to be able to reason over what is in scope, or to change and add to the system while it's live. It is a very powerful technique that allows Juvix to do a lot with little effort.
Image System Goals
Research Areas
Images are as old as computation, with the Lisp 1.5 compiler being an image which wrote to and read from a magnetic strip (source required). However there is very little literature on the subject. This was a list of resources we were able to collect about the subject. Further, since the technique has fallen out of fashion in the past few decades, there are many areas we can explore on this front
First Class Environments
First class environments are a way of making the environment code lives in first class. This means we could talk about discrete environments and more easily distinguish between startup, compilation time, evaluation time, etc environments. There are many bigger implications as well, like being able to talk about environments over the network, having sandboxed environments, etc.
While the benefits are quite promising, the technique seems to suffer
from a lack of research. There is the SICL paper that talks about
adding it to Common Lisp, and the SBCL
compiler which at it's
bootstrapping phase works on creating it's own environment. There is
also MIT scheme which has first class environments
With Juvix, we can explore these ideas a lot further, as we have many systems which facilitate this kind of reasoning. Three particular constraints come together for this.
We have an algebraic effects system
This is very significant for making progress, as we can see precisely how our effects touch the image. If we can determine that, we can likely create a system that can precisely denote the scope of the image we need to reason over.
With that said, we need to be careful with our thoughts here, as free variables are an effect that are discharged by the default handler. Meaning that if the system fully throws this information away as it can lookup in the image what answers are bound to and throw away what it relies upon in the image to function, then this will be harder to manage.
We have multiple backends we must support in a single program.
This means that we already have to tackle the issue of some parts of our language being out of scope.
We are likely to include parts of Racket's
#lang
research, which should help talking about environments on a module level.
We have a first class module system.
We might be able to formalize this idea as our module system, or view it as an extension of our module system.
After all the image is one big module!
If we are able to synthesize 1., 2., and 3. properly along with our type system, we should have a very ergonomic way of creating very eloquent systems that can talk about library versioning, backend support, and evaluation time processing.
Possible Benefits
Talk formally about the various environments
Boot Strapping environment
Evaluation Environment
Compilation Environment
Better Integration with Block chains
We could ingest Anoma data into the image, and have multiple different conflicting nets around.
We can fully explore them as if they were on our live image, and switch between the environments and see what effect our code would have on different sets of conflicting data!
Give us a formal way to talk about the environment where our type system gets injected
The base image will have to not have an image, as that is rather hairy to do.
What this gives us is an environment in which we can talk about everything having a nice type system.
We can even push this further for other kinds of type systems ala what Agda does, but as libraries, not baked in(?)
Leads into a Possible packge/versioning system.
This could give us an LTS model like Haskell has, and maybe even better as we can have multiple versions on our image that doesn't conflict with each other?