Human sacrifice, dogs and cats living together, mass hysteria! and thread model errors!

Reader Shaka comments on my post about error messages that “catastrophic failure” really does take the cake as being a terrible error message. I fondly remember the first time I saw “catastrophic failure” as an error message. I was an intern, running the build lab for Visual Basic for Applications, and I was trying to…

1

Chained user-defined explicit conversions in C#, Part Three

Jeroen Frijters knew the answer to my challenge of last time: how is it that Foo foo = new Foo(); can cause a runtime conversion failure? And how is it that Bar bar = (Bar)(new Baz()); can succeed even if there is no user-defined conversion or built-in implicit conversion between Baz and Bar? The answer…

2

Do Not Call IsBadFooPtr, Indeed

Here’s a story that I said a long time ago that I was going to tell you all, and then promptly forgot about it. Raymond Chen’s blog entry today reminded me of it, because this is the story of how I found out the hard way that IsBadFooPtr is bad, bad, bad. Those of you…

11

Checking For Script Syntax Errors, This Time With Code

A number of people asked me to clarify yesterday’s entry. Rather than try to talk you through it, I think the code is straightforward enough to speak for itself. Here’s a little skeleton that I just whipped up. #include <stdio.h>#include <activscp.h>#include <new> const GUID CLSID_VBScript = {0xb54f3741, 0x5b07, 0x11cf, {0xa4, 0xb0, 0x00, 0xaa, 0x00, 0x4a, 0x55, 0xe8}};const…

9

Implementing Event Handling, Part Two

It’s been an insanely busy month for me, between having multiple out-of-town guests, throwing a party for the people who couldn’t make it to the wedding, and oh yeah, getting up to speed on the C# compiler and trying to understand the implications that LINQ features are going to have on the current implementation.  Not…

3

Implementing Event Handling, Part One

Back in February I posted a bit about how script hosts such as Windows Script Host dynamically hook up event sources (objects) to event sinks (chunks of script that run when the event fires.) It has become apparent from some questions I’ve received recently that it would be helpful to have a more detailed explanation…

0

VBScript Default Property Semantics

Here’s a question I recently got about VBScript, where by “recently” I mean August 28th, 2003. This code works just fine: Set myObject = CreateObject(“myObject”)myObject.myName = “Eric” WScript.Echo myObject ‘ myName is the default property, so prints “Eric” But myObject = “Robert” doesn’t set the default property, it sets the variable to the string. Why does…

11

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…

3

How Do Script Engines Implement Object Identity?

I’ve talked a few times in this blog about the semantics of the equality operators in various languages. (Such as here, and here.) Recently a reader asked me how JScript implements object identity. That is, given two objects, how do we know if they are “the same object” or not? For the remainder of this…

7

Why does WScript.ConnectObject not always work?

I’ve had a tiny handful of entries in my VBScript quiz. I know from my logs that 2600+ people have read it. Come on people, there are fabulous prizes at stake here!  Go for it! I’m going to keep the contest open until Friday morning, at which point I’ll start posting answers and analysis. ****************************************************…

6