Friday, October 15, 2004

I'm trying to quickly write up a tool to compute the transitive closure of all possible exceptions resulting in an invocation to a given method. Checked exceptions are an interesting means by which to attempt compiler enforcement of this. In Java, for example, exceptions that could be thrown are well known primarily because of strict inheritance rules, removing uncertainty by disallowing overriding methods to declare that they throw new exception types (aside from strengthening through polymorphism). The fact that you must either catch or declare that you throw an exception is simply a way to instruct the compiler what you intend to throw or let seep through the cracks. Arguably it could probably do a decent job (clearly not 100%, though) at figuring it out without requiring you to explicitly state it, however. And then perhaps it just becomes a compiler warning when you don't catch something.

Anyhow, I'm trying to hammer out the logic for my program and I came up with this. It's a bit cryptic, and I've probably used some symbols in uncommon ways... oh well... it helped me to think through the situation, and will be a great help when I actually implement it.

To compute the transitive closure of possible exceptions thrown as a result of an invocation to a method:

 

Let d be the method in question and a tuple of <td,md>, where td is the static type being analyzed and md is the method handle. Let C(d) be the set of tuples <iC(d)i,tC(d)i,mC(d)i>, for i = 0 to |C(d)|, representing method calls reachable from within d’s IL body (regardless of certain code paths and/or code path probabilities—probabilistic analysis could be quite interesting, but is not the focus of this effort), where iC(d)i is the instance on which a method is being called (or e for static method calls), tC(d)i is the static type to which the method call refers, and mC(d)i is the method handle being called.

 

Let DirThrows (d) be the set of exception types for which an explicit throw instruction is present within d’s IL body.

 

[informative] RefThrows(d) is defined below to equal the set of exceptions that could be thrown as a result of invoking a method call inside of d’s body, transitively closed on C(d).

 

Let Exc(d) be the set of exception types that could by thrown as a result of invoking method d. Specifically, Exc(d) = { DirThrows(d) È RefThrows(d) | deleting any e for which d‘s body contains an enclosing exception handler that catches e or a base-type and does not issue a rethrow instruction }.

 

Let RefThrows(d) be union of all Ei computed as follows:

 

For each <iC(d)i,tC(d)i,mC(d)i> Î C(d)

 

If virtual(<tC(d)i,mC(d)i>) is false, let Ei = Exc(<tC(d)i,mC(d)i>).

 

Otherwise, if there exists an assignment to iC(d)i of type u within visibility that provides an implementation for which virtual(<u,mC(d)i>) is false or whose instance construction is also within visibility and that can be deterministically proven to be the last known assignment (i.e. non-pointer local variable), let Ei = Exc(<u,mC(d)i>).

 

Otherwise, let T be the set of known derivative types of tC(d)i. If |T| = 0, let Ei = Exc(<tC(d)i,mC(d)i>). Otherwise, let Ei = { the union of all Exc(<u,mC(d)i>) for each u Î T }.

10/15/2004 1:18:27 AM (Pacific Daylight Time, UTC-07:00)  #   

 Thursday, October 14, 2004

I'm feeling better about this book project each time I sit down to work on it. My word count is increasing steadily, and as expected my ability to get in “the zone” and crank out pages is indeed improving. My first draft is actually about 3% complete! :P

10/14/2004 11:38:15 PM (Pacific Daylight Time, UTC-07:00)  #   

As I'm working on my book, I'm trying to remain conscious about making it accessible to as wide an audience as possible. This obviously includes the hobbyist and student crowd. As such, I've been working with the VS Express SKUs... and I must say, they kick mucho butt!

Check 'em out here: http://lab.msdn.microsoft.com/express/

Yeah, yeah, I probably sound like some marketing swine, but so be it. I've always been a fan of lightweight programming environments (emacs, csc, and nant was my standard “ide“ until recently), and these certainly feel more lightweight than Enterprise. Shhh... I won't go so far as to say I prefer Express over Enterprise - I haven't used Express enough to make an informed judgement, and I'm sure there are a slew of nifty features that didn't make it into Express - but when you just want to whack out a bunch of code and don't need a fancy shmancy IDE that supports multiple languages, client- and web- programming together, and the like: this dogfood tastes great.

10/14/2004 12:08:38 AM (Pacific Daylight Time, UTC-07:00)  #   

 Tuesday, October 12, 2004

I need to set up a wiki or some other good means of capturing references and other interesting data. Bookmarks just don't cut it. In the absence of that, I'll just dump the top of my stack right here.

John McCarthy is a smart, smart man. The inventive capabilities of human beings never cease to amaze me.

Some Scheme papers...

A couple other random links...

I've been searching for and have only found a few digital copies of the papers referenced in the last link. This is a great candidate for a wiki so links can easily be added as they are located...

10/12/2004 11:48:02 PM (Pacific Daylight Time, UTC-07:00)  #   

 Monday, October 11, 2004

Yep, one day Haskell and LISP will rule the world. Until then we'll just have to live with C# and its new closure-imitating syntax.

One of my design goals with the managed Scheme compiler is to enable easy interoperability with existing managed languages through delegate-based entrypoints. This communication needs to flow both ways, so that for example a lambda can substitute for a delegate and vice versa. My backend actually has its own representation for functions, enabling fine-grained control over scoping and such, but mutliple entrypoints are provided for this explicit purpose.

So for example,

delegate object Transform(object o);
void Map(Transform a, Array arr)
{
  //...
}

Can be called from a Schema program as follows,

((func-lkup "Map(Transform, Array)")
  (lambda (x)
    (* x 2))
  (10 15 20 25))

...and the other way around.

10/11/2004 11:38:57 PM (Pacific Daylight Time, UTC-07:00)  #   

Krzys just blogged an update that I made a bit ago to the DesignGuidelines document. It's a bit of prescriptive guidance on when to use Factory-based object creation over traditional constructors, mostly influenced by what we've done historically in the Framework. This was actually my first update to “the DG” (as it's commonly referred to), and I've made a few others since then.

The most recent update I made taught me quite a bit during the writing process... I worked with RicoM, Don Syme, and Andrew Kennedy on it (I wouldn't have gotten the facts straight otherwise!), but a whole slew of other folks throughout WinFX also had a shared interest in seeing this topic documented. It's a fairly complicated and heated subject, but the bottom line is that under certain well-defined circumstances two NGen'd images could be unable to share generics instantiation code. In such a situation, the JIT will end up being called in. This ends up being pretty bad, especially when people often go to great lengths to avoid calling in the JIT altogether... surprise!

I'll look into posting the actual DG update over the next couple days... the original email thread on which we hashed out the logic might also interesting to some folks. Maybe I can post that too, in keeping with that whole transparency thingamajiggie.

I'm currently overhauling our guidance on finalization and disposability. The internal feedback keeps pouring in on these topics, and at this point I'm in a hurry just to get something out there to stop the bleeding! ;)

10/11/2004 11:10:58 PM (Pacific Daylight Time, UTC-07:00)  #   

 Sunday, October 10, 2004

As mentioned previously, I ate at the Herbfarm last night... absolutely amazing. 9 courses, 5 hours. Too many glasses of wine. ;) The atmosphere at the restaurant was very different than any other. Many high-end restaurants are stuffy and uncomfortable even though they may serve up killer dishes and have great wine menus, filled primarily with folks entertaining business associates and the like. The Herbfarm, on the other hand, is truly a place for people who love great local, artisinal food and wine to gather and have a great night out.

For memory's sake, here's the menu (yes, that Madeira is from the year nineteen-hundred-one... it's not a typo!):

A Menu for
A Mycologist's Dream
Saturday, October 9, 2004

From the Gatherer's Basket
Grilled Honey Mushroom with Spot Prawn
Bears Tooth Mushroom with Sea Urchin Flan
Poached Flat Oyster with Angel Wings
1998 Domaine Meriwether Brut, Captain Wm Clark Cuvee

Chestnut and Delicata Squash Ravioli
With Cauliflower Mushrooms & Quince in Lemon Thyme Consomme
2003 Poet's Leap Riesling

Herb-Smoked Wild Sturgeon with Matsutake
On Savoy Cabbage with Pear
2003 Patricia Green Cellars Chardonnay, Four Winds Vineyard

Lobster Mushroom, Hedgehog, Hawks Wing, and Blue Chanterelle Mushroom Terrine
With Wilted Spinach and Bacon
2001 Beaux Freres Belles Soeurs Pinot Noir

Concord Grape and Rosemary Ice

Spice-Rubbed Muscovy Duck Breast
With Two Gratins: King Bolete-Potato
And Red Chart-Duck Confit
1999 Glen Fiona Walla Walla Syrah, Puncheon Aged

A Mycologist's Salad
Chanterelles, Yam, Asian Pear & Quillisacut Goat Cheese

Harvest Festival of Desserts
Hardy Kiwi and Lemon Verbena Tart
Pumpkin-Bay Sundae
Carmelized Apple Souffle
With Orange-Thyme Custard Sauce

Brewed Coffees, Teas & Infusions

A Selection of Small Treats
Vintage 1901 Barbeito Malvazia Madeira
Herbfarm Yeasted Corn Bread & Multi-Grain Rolls
Chive-Calendula Butter Coins

10/10/2004 9:21:58 PM (Pacific Daylight Time, UTC-07:00)  #   

 Saturday, October 09, 2004

I've decided to track my book progress by capturing a number of interesting data points at the end of each writing session. If there are other interesting ones folks would like to see, let me know and I'll start recording them.

Here's what I have at the end of my first session... I'm pretty slow right now, trying to get used to the various writing templates, guidelines, and styles provided by my publisher. I hope my output beefens up as I progress.

Date Chapters Done Pages Words Chars Paragraphs Sentences Passive Reading Ease
10/9/2004 0 4 1038 5518 89 41 7% 38.9

At one of my previous jobs, I was affectionately (I think) referred to as the Data Pig. Oink, oink.

10/9/2004 1:31:29 PM (Pacific Daylight Time, UTC-07:00)  #   

 Saturday, October 02, 2004

I've been really bad about blogging lately. So much to do, and so little time in which to do any of it. One thing sure remains constant: time keeps ticking away.

Over the last couple weeks, I've been working on a book proposal and outline. It got submitted last night. I was approached by a publisher a few weeks back to author a book, and if all continues going well I'll likely take the offer. I'm particularly excited about the project albeit a bit scared about the time commitment.

Progress on my Scheme compiler has been minimal because of the book effort. This is really a shame because I'd spend all day working on it if I could. Like I said, time is something I'm short on at the moment.

I began writing a paper which I'd love to complete, but that will likely take some time. It explores using structural equivalence for type matching and operational subsumption, foregoing the artificial inheritance policy that OO slams on types. I'm particularly interested in exploring how this would enable rich ecosystems of types to borrow and share implementations from each other at runtime, introducing mutations in parallel. Basically, an evolutionary type system.

Microsoft has been going well, although it obviously eats up most of my time and energy. Mostly this is a shame, simply because I have research work like my Scheme compiler that I am completely in love with. The energy people have there is just sickening at times, and it's difficult to remain in the game 100% of the time. I've found that it's easy to fall behind and lose effectiveness, simply because of a loss of focus for a minimal amount of time.

I had one of those "you're a moron" moments today. Was sitting there, and suddenly some guy shows up at my office door. I was so involved in what I was doing, my brain just couldn't do the context switch fast enough. Paraphrasing... "Hi, I'm Herb. Do you agree with the premise of the email I sent earlier?" I responded, "The value type finalizer thing?" Blank stare between the two of us. Him: "Value types don't have finalizers..." Perplexed, I thought about it for a moment. Ahh, yes... "Oh, disposable value types." Turns out it was Herb Sutter, a C++ Architect and smart dude. It always amazes me how whenever I open my mouth I make myself look like an idiot.

I went to a friend's place last weekend to hang out. It's great to unwind and let the noggin' relax for a little bit. Unfortunately, it again reminded me of my lack of a strong long term career goal. I used to think that it was being a (successful) entrepreneur, as various business topics have always interested me (such as competition and macro-economics). However, computer science is my passion, and academia and/or a research environment seems like a natural fit. I thought of this because many of the folks at the gettogether were PhD's and there was at least one professor from UoW. I wonder every day if that's my real calling.

Chilled with KitG, JoelPob, and AMoore tonight for a couple beers. Two Aussies and a New Zealander. All on the same team. Who woulda thunk it? Good fun.

Anyhow, it's only 1AM and I've got some reading to do!

10/2/2004 1:06:21 AM (Pacific Daylight Time, UTC-07:00)  #   

 Monday, September 27, 2004

Another one of those "What kind of person am I?" surveys... courtesy of Mr. Sells.

your distinct personality, The Prime Minister might be found in most of the thriving kingdoms of the time. You are a strategist who pursues the most efficient and logical path toward the realization of the goal that you perceive or visualize. You will often only associate with those people who can assist you in the implementation of your plan. Inept assistants may be immediately discarded as excess baggage. To do otherwise could be seen as inefficient and illogical. On the positive side, you can be rationally idealistic and analytically ideological. You can be a bold decision maker and risk taker who can move society ahead by years instead of minutes. On the negative side, you may be unmerciful, impatient, impetuous and impulsive. Interestingly, your preference is just as applicable in today's corporate kingdoms.

I especially love the bit about being impatient and impulsive. Me? Naahhh...

9/27/2004 2:54:34 PM (Pacific Daylight Time, UTC-07:00)  #   

 

RSS 2.0

Me
 

Joe Send mail to the author(s) is an architect and developer on a systems incubation project at Microsoft.

Recent

Search

Browse

Disclaimer:
The content of this site are my own personal opinions and do not represent my employer's view in anyway.

© 2013, Joe Duffy