4 ms·
What you want is not markup, but tagged unions. It's a real shame SQL and many other languages don't support them. Also, your example about Spanish names doesn
by pezezin 7y ago
What you want is not markup, but tagged unions. It's a real shame SQL and many other languages don't support them.
Also, your example about Spanish names doesn't take into account that nowadays parents can choose the order of family names, and that gay marriage has been legal for 15 years. Which reflects a deeper truth: don't make too strong assumptions about reality, for it may change.
- Mikhail_Edoshin 7y agoTagged unions, if I understand what they are, can be done in SQL: create table Foo( fooId primary key autoincrement, type integer /* tag/discriminant */ ); create table FooA(fooId primary key, /* data specific to FooA */ ); create table FooB(fooId primary key, /* data specific to FooB */ ); They're not quite markup though. Markup has a string/stream with associated records. The number of these records, their kind, and their placement varies, so it can handle ordering issues or multiple similar names or missing name (e.g. missing middle name), or ignore parts of name quite naturally.
- naasking 7y agoYes, you can simulate them, but it's painful.
- no-s 7y agoIt's not a simulation, it's a data model for reducing the pain for what's really a hard problem - names we call people are not unique, they are colloquial identifiers (HHOS).
- naasking 7y agoJoined tables on the same primary key are a simulation of tagged unions. Proper tagged unions would solve more concisely and with more clarity.
- Quekid5 7y agoThat could be an implementation of tagged unions. Without language level support (pattern matching, exhaustiveness checking, etc.) you gain very little from this.
- krebs_liebhaber 7y agoI'd really like to see an RDBMS with built-in support for both inheritance and tagged unions. That would solve 90% of my schema woes.