Closed Pyrolistical closed 7 years ago
I completely agree that Pri
sucks, but it makes certain things much easier in the short term. The same concerns apply to Str, Num and Map: we don't actually need them. But I'd say it would be weird to leave those as primitives, but operations on those up to the host's interpretation. Moon without Pri is basically LJSON, which sucked exactly because of the lack of Pri.
Note I consider Moon a transitory thing. The long term goal is to migrate to Morte (i.e., type theory). Then we won't have Pri, Num, Str nor Map. Morte is probably the stable format you're looking for.
I've been thinking about the
Primitive
term. I know you need it for the compiler in order to know you cannot optimize pass it, but I think it shouldn't be an explicit term. I think it can be derived from Apply.If all Primitives are just Applies, then be up to the runtime to provide functions of the matching name. The compiler should automatically just output non-defined Applies as dependencies (which I believe it already does)
Another issue is the binary format. It looks like you have encoded
pris
into binary, which I think makes the binary format far less stable. We would need to rev the binary format every time we added/removed a pri.However, I think we can have the benefit of both worlds. We can add a "predef set" to the binary format. The predefs would map pri function names to short binary codes. This way you can have a stable binary format and be able to add/remove pris in the future with different predef sets. The runtime can just error if it sees a predef set it does not have.