Relations to databases. #722
Replies: 0 comments 1 reply
-
Sorry you post flew under my radar so far. Note that I think it would fit better under the Q&A category, though, as it's more a general question about MVS than something related to Val specifically. Disclaimer: I am not a strong believer in ORMs. I think they are a canonical example of leaky abstraction and so I personally believe that wanting to map relational database queries onto traditional dotted path expressions is a non-goal. Interacting with extrinsic relationships in a practical way is a thorny question. There's actually been an interesting thread about this topic in the community: https://github.com/orgs/val-lang/discussions/61 One solution to approximate your let g = Graph(...)
let e = g.[some_edge].from.name We have tried this approach in Val's source base (e.g., here). Though it definitely has drawbacks, I think it can be a useful pattern. |
Beta Was this translation helpful? Give feedback.
-
Hello! I recently learned about Val and Value Semantics. I feel a database is really just the most common value semantics.
I am designing a serialization schema that support foregin keys. https://www.remnote.com/a/appscript/644e27f7a7a62e343c1ff8b5
Here is an example how to represent a Graph in it:
you get auto-join like
val graph: Graph; val edge: graph.Edge = graph.some_edge(); edge.from^.name
. where^
is the "dereference" operator. But how to type check an expression language like this isn't very clear to me yet. :-)I feel a value semantics is pretty fit as a language for databases. SQL isn't really well designed (https://www.scattered-thoughts.net/writing/against-sql )
Beta Was this translation helpful? Give feedback.
All reactions