Remix.run Logo
CivBase 15 hours ago

What is a table other than an array of structs?

thom 14 hours ago | parent | next [-]

It’s not that you can’t model data that way (or indeed with structs of arrays), it’s just that the user experience starts to suck. You might want a dataset bigger than RAM, or that you can transparently back by the filesystem, RAM or VRAM. You might want to efficiently index and query the data. You might want to dynamically join and project the data with other arrays of structs. You might want to know when you’re multiplying data of the wrong shapes together. You might want really excellent reflection support. All of this is obviously possible in current languages because that’s where it happens, but it could definitely be easier and feel more of a first class citizen.

RobinL 14 hours ago | parent | prev | next [-]

I would argue that's about how the data is stored. What I'm trying to express is the idea of the programming language itself supporting high level tabular abstractions/transformations such as grouping, aggregation, joins and so on.

p1necone 11 hours ago | parent | next [-]

Implementing all of those things is an order of magnitude more complex than any other first class primitive datatype in most languages, and there's no obvious "one right way" to do it that would fit everyones use cases - seems like libraries and standalone databases are the way to do it, and that's what we do now.

camdenreslink 14 hours ago | parent | prev | next [-]

Sounds a lot like LINQ in .NET (which is usually compatible with ORMs actually querying tables).

CivBase 14 hours ago | parent | prev [-]

Ah, that makes more sense. Thanks for the clarification.

FridgeSeal 9 hours ago | parent | prev | next [-]

Well it could be a struct of arrays.

Nitpicking aside, a nice library for doing “table stuff” without “the whole ass big table framework” would be nice.

It’s not hard to roll this stuff by hand, but again, a nicer way wouldn’t be bad.

ModernMech 10 hours ago | parent | prev [-]

The difference is semantics.

What is a paragraph but an array of sentences? What is a sentence but an array of words? What's a word but an array of letters? You can do this all the way down. Eventually you need to assign meaning to things, and when you do, it helps to know what the thing actually is, specifically, because an array of structs can be many things that aren't a table.