

Erik Meijer: The World According to LINQ - mattpodwysocki
http://queue.acm.org/detail.cfm?id=2024658

======
smhinsey
Syntactically LINQ is a breath of fresh air, but it's totally the opposite
when it comes to debugging. Right now the experience of debugging a nested
loop (which typically could be converted to some form of LINQ) is way better
than if you look at the equivalent LINQ.

It's totally possible I am missing some magical IDE feature, but if you want
to do something like take a look at the 4th item in some intermediary part of
a LINQ query, you're out of luck unless you can either break it up into
smaller units of syntax or convert it to a loop.

~~~
politician
Put your cursor on the part of the expression that you want to debug and press
F9 to set a breakpoint. Setting breakpoints by clicking in the gutter doesn't
work for LINQ like you might expect - you have to use the hotkey.

I frequently hear complaints about debugging LINQ, but Visual Studio supports
it well enough. Microsoft could have done a better job informing people about
it.

~~~
smhinsey
Wow, that is probably going to help a lot, thanks. I've been using VS since
the 90s and I still feel like I don't know half of what it can do.

I'm not sure how to fix this, but I am pretty sure the increasing tendency to
release documentation as videos is not the answer.

------
sausagefeet
Does anyone know about what kind of optimizations LINQ gets in the VM? Does it
do something like stream fusion? I wish MS had decided to make .Net
multiplatform, there are a lot of really great things on there, but Windows
just isn't my cup of tea.

~~~
MichaelGG
I don't believe the VM is aware of LINQ at all. As far as optimization,
there's no guarantee to pureness with CLR code, so the compiler/JIT cannot do
very much. (That is, a query composed of multiple parts cannot be turned into
a nice simple loop.) The generated code creates enumerable objects, and
possibly closure objects which are called via delegates.

On the topic of multiplatform, Mono has been working very well for many
people. <http://www.mono-project.com/>

------
papaf
His example of counting unique words is not impressive compared to the unix
command line:

    
    
         sed -e 's/ \+/\n/' words.txt | uniq -c

~~~
prototype56
Now use the same sytax to query yahoo weather. Get the point?

~~~
epistasis
I don't really get the point. Unix has been fantastic at scraping and munging
text for decades.

    
    
      curl http://weather.yahoo.com/united-states/california/san-jose-2488042/ | sed '/Current conditions/s/.*id="yw-temp">\([0-9]\+\).*/\1/'
    

It may be fragile, but _any_ method of extracting data out of HTML is going to
be fragile when the provider changes design or layout.

A tiny bit of knowledge of grep, sed, and awk, and other simple unix text
utilities such as join, comm, cut, paste, goes a long long way.

~~~
Jacob4u2
The example happens to use "munging" text, but I think the GP is trying to
make the point that you can't use sed (effectively) to parse, for instance, a
collection of database entries from an SQL server in the same way that LINQ
would be able to do so.

The tl;dr I got from the article was LINQ is effective at working with sets of
data; not just sets of text data from a text file.

~~~
_delirium
True, although Plan9 pushed that part of the Unix philosophy even further,
towards where it arguably handles some of those more general cases as well,
with "structural regexes" that work on things other than collections of lines:
<http://doc.cat-v.org/bell_labs/structural_regexps/>

~~~
Jacob4u2
Isn't the general consensus that regexes are hard to maintain and debug? I'm
not sure that "structural regexes" are solving the right problem.

I think maybe we're not shooting at the same baskets though (basketball
reference, apologies if you're not from US); I'm trying to write software
applications, not shell scripts.

