Subject relations vs arrow operators #2851
-
|
Hi all, My question would be what practical differences does this actually have? And which approach is recommended? Let's consider the following example:
In both cases (2 and 3), the assertion using relations:
using arrows:
If that is true, then both would require the same amount of operations and thus have equivalent performance characteristics. Maybe my question can even be further generalized: with the existence of the arrow operator, what is to be gained by having subject relations at all? I.e. why would I need to save Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
My understanding is that they're functionally equivalent: anything that can be expressed in terms of subject relations can be expressed in terms of arrows and vice versa. The subject relation syntax came from the Zanzibar paper and we added arrows as an ergonomic handle on the same idea. I personally prefer arrows and recommend folks choose either subject relations or arrows and stick to one approach, but I've seen places where one or the other feels more natural and folks will make exceptions. At this point, we have both for historical reasons: we have enough people using both approaches that we don't want to deprecate either. I think this is something that we could better document. I'll add a note to the documentation repo. |
Beta Was this translation helpful? Give feedback.
-
|
Both ideas actually come from the Zanzibar paper. As you suggested, they are functionally equivalent in most cases, but there is one additional case where a subject relation works: checking for that subject directly, e.g. This is only doable via subject relations and may be relevant contextually, where you want to know that the group's members have that role, versus the group's role being inferred. That's really the only difference :) |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for your quick responses, this clears things up a lot for me! |
Beta Was this translation helpful? Give feedback.
-
|
Yes, i think this is worth documenting because i had the same question many moons ago. In my head, arrows help express "parent-of" relationships, and subject relations help express "child-of" relationships. So depending on your application's domain, one or the other might make more sense conceptually. |
Beta Was this translation helpful? Give feedback.
My understanding is that they're functionally equivalent: anything that can be expressed in terms of subject relations can be expressed in terms of arrows and vice versa. The subject relation syntax came from the Zanzibar paper and we added arrows as an ergonomic handle on the same idea.
I personally prefer arrows and recommend folks choose either subject relations or arrows and stick to one approach, but I've seen places where one or the other feels more natural and folks will make exceptions.
At this point, we have both for historical reasons: we have enough people using both approaches that we don't want to deprecate either. I think this is something that we could better document. I'll…