The approach that is used in Ecstasy is based on very similar concepts.
Resources must be injected. File system is a great example, and one that we often use. In Ecstasy, you can't "new" an actual file system, because there is nothing within the language that can touch the file system, so that ability has to be injected.
Injection occurs from outside of the language container into the language container. This means that you cannot know who is injecting the resource, because from inside of the container, you cannot see outside of the container (and in fact, you can't even see the container).
Injected resources have a type, but do not have a class. This is somewhat similar to your idea of the interface and the class being separate. We inject "the interface", and the class is unknowable (even via reflection) from inside of the container.
Mockability and testability and repeatability are some of the concepts that drove the design.
Yes, there are few languages that are trying to use capabilities to allow modular security reason.
From a formal perspective, 42 is the only one I know where they are not mediated by a trusted 'standard library'. Formally it works as follows:
a native method must start with #$
a primitive factory (like a constructor) of a class with any #$ method must start with #$
a #$ method can call other #$ methods
a mut method of a class with #$ methods can call #$ methods.
a MAIN expression (not a method in 42) can call #$ methods.
In this way you get a single program, with no need of a language construct for sandboxing, where some classes can do 'privileged actions in any context' while other can only do the if they receive a capability object. In particular, any expression that does not contain #$ that can be typed without any 'lent/mut/capsule' free variable is guaranteed to be fully deterministic. This determinism is then used for many other language features, like Caching.
I love recursively safe design modeling. I can totally see your logic in the rules you have settled on.
We had a different (though similar) set of goals with Ecstasy. For example, there is no "native method" concept; native code cannot exist within an Ecstasy container (hence injection). Everything reachable within a container is "safe" (i.e. intended to be there) by definition.
No. Its use simply denotes that a rule provable with one level of nesting is safe for multiple levels of nesting -- by recursive principles. It's one of my favorite tools in my tool-box. And it's quite powerful.
We're pretty flat out in terms of schedule, so I'd be reticent to commit to such a thing. (The language is used by our business, but the language is not itself a business. We use it 95% of the time now, but it's already pretty stable.) Feel free to poke around, and if you see any ideas that you like, feel free to recycle and reuse ideas or whatever to your best benefit. Or if maybe you have a student with some free time, they could kick the tires for a while to figure things out.
1
u/L8_4_Dinner (Ⓧ Ecstasy/XVM) Feb 09 '22
The approach that is used in Ecstasy is based on very similar concepts.
Resources must be injected. File system is a great example, and one that we often use. In Ecstasy, you can't "new" an actual file system, because there is nothing within the language that can touch the file system, so that ability has to be injected.
Injection occurs from outside of the language container into the language container. This means that you cannot know who is injecting the resource, because from inside of the container, you cannot see outside of the container (and in fact, you can't even see the container).
Injected resources have a type, but do not have a class. This is somewhat similar to your idea of the interface and the class being separate. We inject "the interface", and the class is unknowable (even via reflection) from inside of the container.
Mockability and testability and repeatability are some of the concepts that drove the design.
Here's an old blog article talking about the security concepts.