-
Notifications
You must be signed in to change notification settings - Fork 74
exnrefs are nominal #85
Comments
The type It is true that exception tags are generative, however, as in any standard semantics, AFAICT. That's mainly for disambiguation, not encapsulation: unlike regular values, raised exceptions can bypass module/abstraction boundaries implicitly, and mix with others in the same type, so that you cannot generally tell what code they originate from when caught. It is essential for correctness that you can tell apart your exceptions from somebody else's exceptions. |
So what you're saying is that, in any place where We've also said that any coordinated interlanguage communication should be expected to be done using Interface Types. So with those two expectations, is there any situation where |
That's explicitly not what I am saying. I am saying that this applies to the exception type specifically, because throwing shortcuts explicit data flow through abstraction boundaries. In all regular cases, programs have a choice to not mix values in a single type, but with exceptions they haven't, because all exceptions share the same data flow path. Moreover, a local exception may propagate through code that does not know about it, e.g., when library A invokes a higher-order function from library B, and passes one of its own function that throws an exception local to A. Interface types cannot help with such tunnelling. IOW, exceptions need to be extensible sums or something equivalent, and that necessitates generative tags. That's different from subtyping. It does not even necessarily have to do with multiple languages, but just multiple modules defining exceptions independently (though a single language runtime could use secondary tagging to distinguish its own exceptions internally, like LLVM/C++ does). |
The point is that any situation where you have uncoordinated mixing of references from different modules, one example of which is exceptions, modules will want to be able to distinguish their references from other reference, just like with exceptions. And for any situation where you have coordinated communication of data across distinct modules, the plan is to use Integrated Types. If that's not the case, then you should be able to give me an example of where |
I don't think anyref is ever meant for uncoordinated mixing of references. It's primary purpose is avoiding assumptions about what a specific (single) reference type is in places where you can't or don't need to know. E.g., as the bound on a type import or export. |
That example purpose of bounds is much more easily achieved by allowing type imports and exports to not have subtyping upper bounds (just like you allow them to not have lower bounds). The purpose of conveying uninterpreted references has no need for |
We are getting off-topic for this issue and this proposal. I suggest discussing the merits of bounded abstraction on the type imports proposal. |
|
Use plain type substitution instead of type addresses and static/dynamic types
exnref
s are garbage-collected references that you cast to specific cases, so why aren't they using the same structural design as all other garbage-collected references? They're just structs with a tag field (with a hidden trace field?), so it seems inconsistent to design them differently than all the other structs with a tag field out there.The text was updated successfully, but these errors were encountered: