Open alexrp opened 1 year ago
Having thought through the design of basic block versioning and shapes in the runtime, I'm now completely confident this can be implemented in a performant way.
That said, there are still some design issues here that I want to think through. For example, what if a module A
declares friend B
- is it also a friend of B::C
?
A module
A
can declare that moduleB
is a friend and so is allowed to access private members ofA
. The keyword is already reserved.Something like this:
a.cel
:b.cel
:For this to work, the semantics of a field expression (
.
operator) would be changed to pass along the accessing module when looking up the member. The runtime would then check if the resolved module declares the accessing module as a friend.This sounds inefficient, but I think object shapes and basic block versioning based on types would allow us to fully specialize most such cases. This feature can only realistically be prototyped and considered once we have a runtime capable of such optimizations.
This is tentatively approved for 2.0, pending prototyping.