Re:The SQL filter clause: selective aggregates
by Arnavion on Monday May 30, 2016 @03:26PM
(#11802659)
>LINQ to SQL/Objects provides static query generation but doesn't compose
How do you mean? The result of a LINQ query is a sequence that can be used as the input of another LINQ query.
Re:The SQL filter clause: selective aggregates
by virtualwhys on Monday May 30, 2016 @04:01PM
(#11802849)
By LINQ query I mean LINQ to SQL, not the basic LINQ collections functionality (the equivalent in Scala being for comprehensions, BTW).
If you have an example of .NET based query composition to share I'd like to see it; last I checked there was no such functionality available.
Re:The SQL filter clause: selective aggregates
by MichaelGG on Monday May 30, 2016 @04:23PM
(#11802965)
LINQ to SQL ends up creating an expression on IQueryable. You can build this expression up any way you want, including in bits and pieces. You can tack on Wheres and Selects any time you like. It's more composable than pain text SQL since the parts can go in any order.
It's only after you force it to materialize (I.e. call ToList) that you can't further "compose" it.
Nonsense, Scala is arguably leading the way in the statically typed composable query dsl department; see Slick [1] and Quill [2] among others.
Outside of Haskell's Esqueleto I am not aware of any statically typed query dsl that comes remotely close to the aforementioned. LINQ to SQL/Objects provides static query generation but doesn't compose; beyond that, what is there?
[1] https://github.com/slick/slick [2] https://github.com/getquill/quill