3 ms·
PRQL is cool, except I liked it better when it was called LINQ.
by kasajian 4y ago
PRQL is cool, except I liked it better when it was called LINQ.
- akmittal 4y agoI keep hearing LINQ is the best, Can anyone explain how its better than say prisma?
- maxfurman 4y agoLINQ is neat because it maps from the C# IEnumerable API to SQL. So you use the same methods to work with in-memory collections as you do database tables, which leads to a very natural feeling programmer experience. Compare to Rails' Active record where `things.where(foo: 6)` calls out to the database but `things.filter { |t| t.foo == 6 }` will pull all the things into memory and then iterate through them to create the filtered list. In LINQ those are both `things.Where(t => t.foo == 6)` and the type of "things" determines where the query executes.
- rzzzt 4y agoThis needs language / introspection support when converting to SQL as you need to pick apart the expression's AST to figure out that it's eg. a simple equals check on one of the fields.
- contravariant 4y agoWell one of the things that makes it neat is that it works for any Monad. Where Monad means any implementation of the following method F<Y> SelectMany(F<X> input, Func<X, F<Y>> map) this could be a function where you have a list of things, apply a function to each element that returns a list and the result is the concatenation of the individual lists. Or you could use it for stuff like tasks where the result is a task that returns something like `await map(await input)`.
- aerzen 4y agoSo LINQ that can be used with languages other than C#?