Functions are not frames

I just realized that on my list of features missing from JScript.NET “fast mode” I forgot about the caller property of functions.  In compatibility mode you can say   function foo(){bar();} function bar(){print(bar.caller);} foo();   In fast mode this prints null, in compatibility mode it prints function foo(){bar();}.   Eliminating this feature does make it…


Global State On Servers Considered Harmful

The other day I noted that extending the built-in objects in JScript .NET is no longer legal in “fast mode”.  Of course, this is still legal in “compatibility mode” if you need it, but why did we take it out of fast mode?   As several readers have pointed out, this is actually a kind…


How many Microsoft employees does it take to change a lightbulb?

UPDATE: This article was featured in The Best Software Writing I. Thanks Joel! Joe Bork has written a great article explaining some of the decisions that go into whether a bug is fixed or not. This means that I can cross that one off my list of potential future entries. Thanks Joe! But while I’m at it,…


JScript Goes All To Pieces

My entry the other day about fast mode in JScript .NET sparked a number of questions which deserve fuller explanations.  I’ll try to get to them in my next couple of blog entries.   For example, when I said that it was no longer legal to redefine a function, I wasn’t really clear on what…


The Most Boring Story Ever

The other day a reader suggested:        Make a blogentry about how you started at MS and so on!   You asked, but I’m warning you: it’s the most boring story ever.   I grew up in Waterloo , Ontario , which was a piece of luck as Waterloo has the best computer science…


Compatibility vs. Performance

Earlier I mentioned that two of the design goals for JScript .NET were high performance and compatibility with JScript Classic. Unfortunately these are somewhat contradictory goals! JScript Classic has many dynamic features which make generation of efficient code difficult. Many of these features are rarely used in real-world programs. Others are programming idioms which make…


Michael’s Security Blog is online

Michael Howard has started blogging.  If you’re interested in writing secure code (and these days, who isn’t?) you could do worse than to read anything he writes. 


Attention passengers: Flight 0703 is also known as Flight 451

I hate octal.  Octal causes bugs.  I hate bugs, particularly stupid “gotcha” bugs.   Foolish C programmers do things like   int arr_flight = 0703;   not realizing that this does not assign the number 703, but rather 7 x 64 + 3 = 451.   Even worse, foolish JScript programmers do things like   var…


Making Sense of HRESULTS

    Every now and then — like, say, this morning — someone sends me this mail:    I’m getting an error in my JScript program.  The error number is -2147024877.  No description.  Help!   Making sense of those error numbers requires some delving into the depths of how COM represents errors — the HRESULT….


Constant Folding and Partial Evaluation

A reader asks “is there any reason why VBScript doesn’t change str = str & “1234567890” & “hello”  to str = str & “1234567890hello” since they are both constants?”   Good question.  Yes, there are reasons.   The operation you’re describing is called constant folding, and it is a very common compile-time optimization.  VBScript does…