4 ms·
It's a nice list, but I believe there are two major faults in your comparison. The first is that LINQ supports "transducers" completely and by default for all e
by BoiledCabbage 7y ago
It's a nice list, but I believe there are two major faults in your comparison. The first is that LINQ supports "transducers" completely and by default for all enumerable collections. Its built in to the language and has been there from the start (almost 8 years before they were added to Clojure). Taking for example the top language from the list, Swift, as far as I know Swift doesn't support them. And my intuition is that many to most languages on the list there don't support that behavior by default. That's a fairly large difference.
The second is, if you're going to compare languages based on compactness of syntax, you can't write other languages using a compact fluent syntax, and then write c# with SQL and say the other languages are more compact.
LINQ comes with a compact fluent syntax and a verbose (but more familiar at the time and thus easier ramp) SQL syntax. The documentation when introducing concepts it used the SQL syntax. As anyone who has familiarity with the tools uses the fluent syntax. Yes you can say you used samples from the docs, but those are for teaching. You can't compare them to hand written code using a compact syntax. Use the flutent syntax for all both langs to do an accurate comparison.
I applaud the effort, but it's not an accurate comparison in it's current form.
- mythz 7y agoYour entire comment suggests you didn't bother to read the project docs? These are Microsoft's MSDN C# 101 LINQ Examples, I did not write the C# LINQ Examples, Microsoft did, to show how to use LINQ. The languages are a comparison to their docs, I'm not rewriting their C# examples, otherwise it couldn't be called "C#'s 101 LINQ Examples in ....". LINQ is the query language that's used in the 101 LINQ Examples, it's not the "compact fluent syntax" you're referring to of calling IEnumerable<T> extension methods directly, that's not the "Language-Integrated Query" that LINQ stands for, the purpose of Microsoft LINQ Examples was to showcase how to use LINQ. The purpose of each language comparison was to achieve the same result of each example, but in the idiomatic style of that language.
- thrower123 7y agoThe extension method syntax is the de facto idiomatic standard. The idiosyncratic special syntax was misguided and fortunately is largely abandoned. Alas we are stuck with the reserved keywords forever.
- mythz 7y agoIt's not a standard, they're extension methods on IEnumerable<T> in the System.Linq namespace, extension methods anyone could write and use instead. The "idiosyncratic special syntax" you're referring to is called LINQ.
- deleted 7y ago[deleted]
- goto11 7y agoThe special syntax is called "query syntax". LINQ is the whole set of features including the IEnumerable<T> extension methods, expression trees and so on.
- ygra 7y agoThey are contextual keywords and not reserved. C# has never introduced new keywords that change the meaning of existing code.
- goto11 7y agoThe special syntax has clear readability advantages when using join's or let's or multiple from's. For simpler queries, I agree the regular method chaining syntax is clearer.
- recursive 7y ago> fortunately is largely abandoned Also fortunately, it's not totally abandoned. You can have my `let` when you pry it from my cold fingers.
- BoiledCabbage 7y ago> Your entire comment suggests you didn't bother to read the project docs? Yes I both read the msdn examples docs many years ago when they came out when first learning LINQ, and clicked through and read them again in your provided links of your project docs to confirm your implementations. I thought there were two possible things happening here. I took the charitable interpretation and assumed you may not be familiar with the fluent syntax nor the fact it is the standard syntax. Or possibly you may not be familiar with the fact that those examples are meant mainly for instructing the concepts underlying each function and are not best practices. I had all of that in mind when I wrote the following. > The documentation when introducing concepts it used the SQL syntax. As anyone who has familiarity with the tools uses the fluent syntax. Yes you can say you used samples from the docs, but those are for teaching. You can't compare them to hand written code using a compact syntax The other interpretation, the one I avoided was that you were not looking for a fair comparison for programmers to learn from. Your response makes it harder for me to ignore this second interpretation. If I were the owner of a project and looking for a fair comparison, I'd be happy if someone let me know I wasn't using the correct practices in C# and would want to update my project to reflect that. Possibly creating an implementation in C# of what LINQ actually looks like in use. Instead you're digging in deeper behind the "that's what's in MSDN examples documentation". To put it directly, if you want a fair comparison between languages for people to learn from, and make judgement from, then make it so. Don't use the antiquated SQL syntax. Please make this a helpful project for people and use the de facto standard syntax. There are differences between languages and a fair comparison would let people learn them.
- mythz 7y agoHow is this too hard for you get? The examples show how different languages implement each of C#'s 101 LINQ Examples. You shouldn't need any charitable explanation or imagination to be able to read the title and purpose of each project that's clearly explained in the docs. Your criticism tantamounts to: > Your 6-7 year old "C#'s 101 LINQ comparisons" series is using the actual "C#'s 101 LINQ Examples", Unfair! Then go ahead and produce your own series, instead of wasting your time and energy on criticizing others efforts.
- 7y ago
- goto11 7y agoYou state that "I don't view LINQ as a major strength of C# anymore". But the examples doesn't really go into the real power of Linq, which is the combination of IEnumerable and IQueryable and expression trees.