Sign In
Fabulous Adventures In Coding
Eric Lippert's Blog
Tags
Aargh! (8)
accuracy (6)
Arrays (8)
ASP (11)
AStar (5)
Async (15)
bad jokes (14)
Begging the question (4)
Benford's Law (3)
Best Of FAIC (12)
Big Words (5)
Books (23)
Breaking Changes (24)
Brittle Base Classes (6)
C# (327)
C# 4.0 (39)
C# 5.0 (10)
Cargo Cult Programming (4)
cast operator (3)
Channel 9 (6)
Charts (6)
closures (3)
Code Generation (10)
Code Quality (29)
COM Programming (57)
Conditional Operator (3)
Continuation Passing Style (11)
Conversions (16)
Covariance and Contravariance (22)
customer service (4)
declaration spaces (5)
definite assignment (3)
Dialogue (14)
English Usage (11)
exception handling (9)
Floating Point Arithmetic (15)
grammars (9)
graph colouring (5)
GUIDs (4)
Hashing (9)
High Dimensional Spaces (5)
Immutability (27)
integer arithmetic (5)
Interviewing (8)
Introduction (6)
It Hurts When I Do This (5)
Iterators (10)
JScript (93)
JScript .NET (29)
keywords (4)
Lambda Expressions (20)
Language Design (62)
local variables (3)
localization (3)
Mathematics (18)
Memory Management (13)
Metablogging (9)
Mistakes (6)
Music (6)
myths (7)
namespaces (5)
Non-computer (37)
Optional arguments (5)
Overload Resolution (9)
Pages (25)
Performance (48)
precedence (4)
precision (7)
protected (7)
Puzzles (49)
quotable quotations (4)
Rants (51)
Rarefied Heights (52)
reachability (4)
Recursion (26)
reference (4)
Regular Expressions (13)
Relationships (4)
Salt (4)
Science (12)
scope (5)
Scripting (189)
Security (47)
shadowcasting (6)
SimpleScript (30)
Software development methodology (13)
Static Methods (6)
Threading (18)
Topological Sort (4)
Type Inference (18)
type safety (4)
unsafe code (4)
Value Types (11)
VBScript (80)
Video (12)
virtual dispatch (9)
VSTO (10)
warnings (5)
What's The Difference? (11)
Zombies (4)
Browse by Tags
MSDN Blogs
>
Fabulous Adventures In Coding
>
All Tags
>
lambda expressions
Tagged Content List
Blog Post:
Never Say Never, Part One
Eric Lippert
Can you find a lambda expression that can be implicitly converted to Func<T> for any possible T? . . . . . . . . . . . Hint : The same lambda is convertible to Action as well. . . . . . . . . . Func<int> function = () => { throw new Exception(); }; The rule for assigning lambdas to delegates...
on
21 Feb 2011
Blog Post:
Closing over the loop variable, part two
Eric Lippert
(This is part two of a two-part series on the loop-variable-closure problem. Part one is here .) UPDATE : We are taking the breaking change. In C# 5, the loop variable of a foreach will be logically inside the loop, and therefore closures will close over a fresh copy of the variable each time . The ...
on
16 Nov 2009
Blog Post:
Closing over the loop variable considered harmful
Eric Lippert
(This is part one of a two-part series on the loop-variable-closure problem. Part two is here .) UPDATE : We are taking the breaking change. In C# 5, the loop variable of a foreach will be logically inside the loop, and therefore closures will close over a fresh copy of the variable each time . The ...
on
12 Nov 2009
Blog Post:
Iterator Blocks Part Seven: Why no anonymous iterators?
Eric Lippert
This annotation to a comment in part five I think deserves to be promoted to a post of its own. Why do we disallow anonymous iterators? I would love to have anonymous iterator blocks. I want to say something like: IEnumerable<int> twoints = ()=>{ yield return x; yield return x*10; }; foreach...
on
24 Aug 2009
Blog Post:
Mmm, Curry
Eric Lippert
A recent comment asked why Haskell programmers sometimes write C# lambdas in this style: Func<int, Func<int, int>> add = x=>y=>x+y; which is then invoked as sum = add(2)(3); because of course the first invocation returns a function that adds two, which is then invoked with...
on
25 Jun 2009
Blog Post:
The Stack Is An Implementation Detail, Part One
Eric Lippert
" style="BORDER-TOP-WIDTH: 0px; DISPLAY: inline; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: 0px; MARGIN-RIGHT: 0px; BORDER-RIGHT-WIDTH: 0px" height=240 alt="Stack " src="http://blogs.msdn.com/blogfiles/ericlippert/WindowsLiveWriter/TheStackIsAnImplementationDetail_C978/Stack_thumb_1...
on
27 Apr 2009
Blog Post:
Five-Dollar Words For Programmers, Part Three: Homoiconic
Eric Lippert
Jeff Atwood was kind enough to once more give me the shout-out in his blog the other day . Thanks Jeff! This inspires me to continue my series on five-dollar words for programmers. Here’s one that I only learned relatively recently, when I helped write the code that translates a lambda expression into...
on
23 Mar 2009
Blog Post:
Method Type Inference Changes, Part One
Eric Lippert
I want to start this by discussing the purpose of method type inference, and clearing up some potential misunderstandings about type inference errors. First off though, a brief note on nomenclature. Throughout this series when I say "type inference" I mean "method type inference", not any of the other...
on
17 Jun 2008
Blog Post:
Reading Code Over the Telephone
Eric Lippert
In my youth I once attended a lecture given by Brian Kernighan on the subject of code quality, which was very influential on my attitudes towards writing legible code. One of the things that Kernighan recommended was to endeavour write code that was so clear that it could be easily read over the phone...
on
16 May 2008
Blog Post:
Translating intentions and mechanisms
Eric Lippert
Before I get into today's blogging, a quick note about my recent post on How To Not Get A Question Answered . That was certainly not intended to be fishing for compliments or chiding people for never acknowledging help ten years ago; that said, I appreciate both. Thanks to everyone who made thoughtful...
on
25 Mar 2008
Blog Post:
Future Breaking Changes, Part Two
Eric Lippert
Last time I mentioned that one of the subtleties of programming language design is weighing the benefit of adding a feature against the pain it will cause you in the future. This is a specific subset of a more general set of problems. Languages run into the same problem that other large, multiply-versioned...
on
31 Aug 2007
Blog Post:
FYI: C# and VB Closures are per-scope
Eric Lippert
This post assumes that you understand how closures are implemented in C#. They're implemented in essentially the same way in the upcoming version of Visual Basic. As Raymond and Grant point out in their various articles on the subject, the question of whether or not two instances of a delegate share...
on
6 Jun 2007
Blog Post:
Lambda Expressions vs. Anonymous Methods, Part Five
Eric Lippert
Last time I demonstrated that the compiler could have to do an exponential number of bindings in order to determine whether there was a unique best overload resolution for a function call that takes a lambda. Some of you may have wondered whether we simply were not being clever enough in the compiler...
on
28 Mar 2007
Blog Post:
Lambda Expressions vs. Anonymous Methods, Part Four
Eric Lippert
Hey all, sorry for the long time between posts; I have been crazy busy recruiting , interviewing, fixing bugs, making performance improvements and implementing last-minute changes to the language and expression tree library. The last few posts about lambda binding yielded many interesting comments which...
on
26 Mar 2007
Blog Post:
Lambda Expressions vs. Anonymous Methods, Part Three
Eric Lippert
Last time I said that I would describe a sneaky trick whereby you can get variable type inference out of a lambda by using method type inference. First off, I want to again emphasize that the reason we are adding so many type inferencing features to C# 3.0 is not just because it is convenient to reduce...
on
12 Jan 2007
Blog Post:
Lambda Expressions vs. Anonymous Methods, Part Two
Eric Lippert
We interrupt the discussion of how the difference between lambda expression and anonymous method convertibility leads to potential performance problems in the compiler to answer a user question. Within hours of yesterday's post readers Raymond Chen and Marc Brooks both asked me the same question....
on
11 Jan 2007
Blog Post:
Lambda Expressions vs. Anonymous Methods, Part One
Eric Lippert
As you know by now if you've been reading this blog for a while, I am incredibly excited about adding lambda expressions to C# 3.0. I thought I'd talk a bit today about an incredibly subtle difference between C# 2.0 anonymous methods and C# 3.0 lambda expressions which has caused me no end of stress...
on
10 Jan 2007
Blog Post:
Why does a recursive lambda cause a definite assignment error?
Eric Lippert
Hey fabulous readers, sorry for not much blogging lately. Between implementing LINQ and making plans to attend my first Burning Man, there's been no time for anything. We've had lots of new ideas generated here for the type inferencing algorithm which I will discuss in detail when I get back. For...
on
18 Aug 2006
Blog Post:
Delegates, Lambdas, Type Inference and Long Playing Records
Eric Lippert
Today is my 33 1/3rd birthday! I'm one third of the way through my first century. I feel like I should go buy some LPs to celebrate, not that I have anything that will play them. In other news, someone sent me this code the other day. Suppose you've got a collection of mammals and you want to feed...
on
31 Mar 2006
Blog Post:
Why are base class calls from anonymous delegates nonverifiable?
Eric Lippert
I'm still learning my way around the C# codebase – heck, I'm still learning my way around the Jscript codebase and I've been working on it for nine years, not nine weeks. Here's something I stumbled across while refactoring the anonymous method binding code last week that I thought might be interesting...
on
14 Nov 2005
Page 1 of 1 (20 items)