Browse by Tags

Tagged Content List
  • Blog Post: Persistence, Facades and Roslyn's Red-Green Trees

    We decided early in the Roslyn design process that the primary data structure that developers would use when analyzing code via Roslyn is the syntax tree . And thus one of the hardest parts of the early Roslyn design was figuring out how we were going to implement syntax tree nodes, and what information...
  • Blog Post: String interning and String.Empty

    Here's a curious program fragment: object obj = "Int32"; string str1 = "Int32"; string str2 = typeof(int).Name; Console.WriteLine(obj == str1); // true Console.WriteLine(str1 == str2); // true Console.WriteLine(obj == str2); // false !? Surely if A equals B, and B equals C, then A equals C; that...
  • Blog Post: The Stack Is An Implementation Detail, Part One

    " 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...
  • Blog Post: Representation and Identity

    (Note: not to be confused with Inheritance and Representation .) I get a fair number of questions about the C# cast operator. The most frequent question I get is: short sss = 123; object ooo = sss; // Box the short. int iii = (int) sss; // Perfectly legal. int jjj = (int) (short) ooo; // Perfectly...
  • Blog Post: Santalic tailfans, part two

    As I have said before many times , there is only one sensible way to make a performant application. (As an aside: perfectly good word, performant, deal with it!) That is: Set meaningful, measurable, customer-focused goals. Write the code to be as clear and correct as possible. Carefully measure your...
  • Blog Post: A nasality talisman for the sultana analyst

    The other day my charming wife Leah and I were playing Scrabble Brand Crossword Game (a registered trademark of Hasbro and Mattel) as is our wont. I went first, drawing the Q and a bunch of vowels. Knowing that the Q is death to hold onto, I immediately opened with QI for 22 points. I silently thanked...
  • Blog Post: Arrays considered somewhat harmful

    I got a moral question from an author of programming language textbooks the other day requesting my opinions on whether or not beginner programmers should be taught how to use arrays. Rather than actually answer that question, I gave him a long list of my opinions about arrays, how I use arrays, how...
  • Blog Post: Trivial Projections Are (Usually) Optimized Away

    OK, computers aren't entirely dumb when it comes to LINQ. Here's an example of a place where we're a bit smarter. Consider the following query: IEnumerable<int> query = from n in number_array orderby n select n; Does this get transformed by the compiler into IEnumerable<int> query...
  • Blog Post: Computers are dumb

    A few short takes today, from questions I've received recently about LINQ in C# 3.0. The first question was " in the following code, does it really check every single non-negative integer, or does it use the knowledge that once you're beyond ten, you can stop iterating? " var smallNumbers = Enumerable...
  • Blog Post: Lambda Expressions vs. Anonymous Methods, Part Five

    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...
  • Blog Post: Lambda Expressions vs. Anonymous Methods, Part Four

    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...
  • Blog Post: 250% of what, exactly?

    I just got a question this morning about how to take two collections of items and determine how many of those items had the same name. The user had written this straightforward but extremely slow VBScript algorithm: For Each Frog In Frogs For Each Toad In Toads If Frog.Name = Toad.Name Then SameName...
  • Blog Post: Caching Dispatch Identifiers Is A Bad Idea

    About two years ago I wrote a bit about when it was legal to cache a dispatch identifier so that you didn’t have to look it up a second time . I was reminded of this today because the scripting sustaining engineering team was working on a bug that involved a customer incorrectly caching a dispatch identifier...
  • Blog Post: Scripting Type Library Constant Injection Performance Characteristics, Part Three

    We’ve got a system that meets all our needs for disambiguating hierarchical constants through partial or full qualification. (In the event of a collision between an enumerated type name and a value in a given library, the type name wins so that full qualification can work.) But what about the performance...
  • Blog Post: Scripting Type Library Constant Injection Performance Characteristics, Part Two

    Script developers can declare constants, variables, functions and classes at global scope by writing the appropriate lines of code. Script hosts (Internet Explorer, ASP, WSH, etc) however can only add objects to the script engine’s global scope. For practical purposes, it’s as though the host creates...
  • Blog Post: Scripting Type Library Constant Injection Performance Characteristics, Part One

    (Sorry about the title. I work for Microsoft; we like nouns .) Over a year ago now a reader noted in a comment to this posting that defining named constants using Const in VBScript or var in JScript is way, way faster than importing a type library. My empirical JScript testing showed that loading...
  • Blog Post: High-Dimensional Spaces Are Counterintuitive, Part Five

    All of this stuff about high dimensional geometry has been known for quite a while. The novel bit that this paper is all about is how to actually build a fast index for searching a high-dimensional space where the query has a strong likelihood of being junk . The idea that these smart Microsoft researchers...
  • Blog Post: High-Dimensional Spaces Are Counterintuitive, Part Four

    It's reasonably common to have a database containing a few thousand or million points in some high-dimensional space. If you have some "query point" in that space you might like to know whether there is a match in your database. If you're looking for an exact match then the problem is pretty easy --...
  • Blog Post: High-Dimensional Spaces Are Counterintuitive, Part Three

    My next book project is ready for copyediting, the wedding invitations are sent out, my bug count is under control, I've got a layer of levelling compound poured in the basement, there's no more ivy on my roof, and I’m rigging my sailboat some time this week (about six weeks later than I would have liked...
  • Blog Post: High-Dimensional Spaces Are Counterintuitive, Part Two

    The volume of an n-cube of edge length s is easy to work out. A 2-cube has s 2 units of area. A 3-cube has s 3 units of volume. A 4-cube has s 4 units of 4-volume, and so on -- an n-cube has s n units of n-volume. If the n-cube has edge of s>1, say s=2, then clearly the n-volume dramatically increases...
  • Blog Post: High-Dimensional Spaces Are Counterintuitive, Part One

    A friend of mine over in Microsoft Research pointed out to me the other day that high-dimensional spaces are really counterintuitive. He'd just attended a lecture by the research guys who wrote this excellent paper and we were geeking out at a party about it. I found this paper quite eye-opening and...
  • Blog Post: How To Obtain The Name Of The Client From The ASP Server

    Here's a question about client side vs. server side scripting that I got recently: I want to get the machine name of the client the request is being made from. With ASP I can get the IP address using this code: ipaddr = Request.ServerVariables("REMOTE_ADDR") But I don’t know how to get the name of...
  • Blog Post: Google Desktop On The Cheap Part One: Nope, That Doesn't Work

    So, how many files are we talking about here? I've got over thirty thousand source code files containing over seven million unique words. There are pretty much two kinds of words -- words that occur in one, two, a dozen files, and words that occur in almost every file. ("Microsoft", "next", etc.) An...
  • Blog Post: Google Desktop On The Cheap, Part Zero

    Before I get started with my next series, two quick notes. First, at long last I had dinner with famed JOS poster (and east coast technical evangelist for my product, VSTO) Philo the other night, as he happened to be in Redmond. I'm pleased to report that he's as witty, urbane and opinionated in real...
  • Blog Post: Aargh! Part Eight, plus Boring Metablogging

    Q: What's a pirate's second favourite mode of transportation? A: A caaaaargh! Preferably a Jaguaaaaargh, but an early Oldsmobile Cutlass will do. Q: Very amusing -- but what's a pirate's favourite mode of transportation? A: A pirate ship, silly. Gripe #10: Don't use _alloca _alloca allocates...
Page 1 of 2 (49 items) 12