3 ms·
The real language part of LINQ isn't the simple sequence functions (.NET had them before LINQ), it's the LINQ monad embedded into the language. While personall
by MichaelGG 13y ago
The real language part of LINQ isn't the simple sequence functions (.NET had them before LINQ), it's the LINQ monad embedded into the language.
While personally I don't think I've ever used the LINQ monad syntax, and wish it had been implemented as a generic feature, not every language with support for anonymous functions or closures or function pointers is "LINQ".
- olmo 13y agoSome problems with the Go implementation: Looks like go does not have something similar to extension methods, so a result() call should be put at the end to unwrap the collection. The lambda syntax is even worst than C++ and no query expressions (aka monad syntax) Most important: No IQueryable<T> Expression<Func<...>> so doesn't work with remote data sources (SQL, mongo,...) But the library looks ok given the possibilities
- fleitz 13y agoGo pretty much only has extension methods.
- aabalkan 13y agoIn .NET, extension methods are functions defined on the classes you don't own, like string or System.Net.WebRequest. In Go, you cannot define functions on builtin types and exported types from packages other than your own package. So Go way of defining functions on types is not exactly extension methods.
- aabalkan 13y agoGreat comments. I have thought about creating an interface so people can just implement their own query evaluation methods and, as you said, do querying from remote data sources. That's still a long-term plan, though, I probably need to see somebody using it before digging that deep.
- MichaelGG 13y agoDoes golang support reified code/expression trees/quoted code/whatever you wanna call it? That seems to be a rather critical part of making it work. Or you use RethinkDB's RQL approach, which implements a bunch of functions that record what you did, at the cost of not being able to put relatively arbitrary expressions inside the query. Or how else do you translate ".Where(x -> x.Age > 10)" into SQL?
- aabalkan 13y agoI am afraid that's actually not 100% accurate. Microsoft also uses term "LINQ" for method-based query syntax. See here: http://msdn.microsoft.com/en-us/library/bb896339(v=vs.110).aspx http://msdn.microsoft.com/en-us/library/bb896339(v=vs.110).a...
- MichaelGG 13y agoYes, I know Microsoft put "LINQ" over the entire thing, but calling map, filter, fold etc. "LINQ" seems to be a huge stretch. Method-based query options were around in .NET and C# before the LINQ name existed. It's not really "Language INtegrated" if there's no real language aspect, is it?