Tail Calls
Dan Sugalski explains the tail call optimization, which makes deep recursions practical.
Dan Sugalski explains the tail call optimization, which makes deep recursions practical.
Dan Wood relays that Cocoa will be getting some functionality from EOF that will make much of today’s hand-written controller code unnecessary. Good Apple.
Wood also notes that, in Panther, Watson’s toolbars will show the currently selected tool. I have very mixed feelings about this. On the one hand, it makes Watson’s toolbar clearer. On the other, it’s a reminder of how many different things people use toolbars for. In Watson and System Preferences, they’re like a set of favorite tabs with icons. In Mail’s preferences there are no favorites; the toolbar shows all of the “tabs,” and they are not reorderable. In the Finder, there are verbs on the toolbar (Burn, Get Info) as well as verb-noun hybrids like folders. A folder icon in a Finder toolbar is a destination for drags, and also a command for showing that folder’s contents in the window. Should the Finder highlight the toolbar icon of the currently visible folder? That would mean highlighting and unhighlighting icons as you navigate within the window. And it would look rather strange if you don’t have the folder icons grouped together in the toolbar. Apple’s guidelines really need to address these issues.
Oh, and here’s a link for whoever maintains the ADC Web site. Bad Apple.
We all need icons, for our NSToolbars and documents, not to mention the all-important application icon itself. I propose that we work together to end this drought of decent icons amongst the artistically challenged of the OS X dev community.
Eric Kidd (via Dave Winer):
I’m a 27-year-old programmer. When I’m 55—in 2031—I want to still be a programmer. And in 2031, I want to love my job as much as I do today. What will 2031 look like? Right now, two groups are offering their visions for the future: Microsoft and the open source movement. A third group is conspicuously silent: small, independent developers. What do the Microsoft and open source futures look like? Will the independent developers speak up? Which future should I fight for? My choices, and the choices of hundreds of thousands of people like me, will help determine which future we get.
Why is it that wrapper utilities like this never seem to handle shell quoting properly?
According to Steven Estrella, winner of the Bare Bones Software 10th Anniversary Essay Contest, BBEdit will help create “a new theme song will finally inspire the Red Sox to win their first World Series since 1918.”
I like Netflix and all, but this patent is pretty silly. However, the patent system has become a game where everyone is forced to play, if only for defense.
I don’t understand why so many people use mac.com e-mail addresses when the service is seemingly so unreliable. Probably two thirds of the order confirmations eSellerate sends on my behalf that bounce are directed at mac.com addresses, and 7/7 in the last week.
Matt Gemmell has my favorite writeup of Panther and its new metallic Finder. I can’t wait to see how Apple will change the human interface guidelines to suit this whim. Personally, I think it’s time to change the default system fonts and smoothing since (according to John Geleynse) they were specifically designed for striped backgrounds, and stripes are now passé.
But metal is just the skin, and what really matters about the new Finder is what’s underneath. Is it fast? Is it buggy? Has Apple actually thought about this design, or is it just another one to throw at the wall to see if it’ll stick? Time will tell, and I’ll be using Path Finder at least until Panther ships.
More coverage from around the Web:
And some links from Apple:
Unfortunately, unless they’re saving the news for the Cocoa Update session, Apple apparently isn’t bringing back EOF. However, they do appear to realize that Project Builder is lacking and are doing something about it. Hopefully they’ll be open about it so that BBEdit and other editors can get context-sensitive symbol completion and lookup. Or, better yet, they’ll open source the developer tools so that the community can help build what it needs. High on my list would be a way to build and embed frameworks without resorting to obscure incantations. They should be at least as easy to use as jars!
Apple’s posted an update to GCC on ADC. The release notes strongly implied that this wouldn’t trample over my existing GCC 3.1 installation, but after running the installer SQLite started giving me compiler errors because of a deprecated header. Sure enough, /usr/bin/gcc was linked to /usr/bin/gcc-3.3. sudo gcc_select 3
put everything back to normal.
Google’s AdSense lets Web sites serve targeted text ads to generate revenue. I’m trying it out on ATPM. I couldn’t get the login to work with Safari (it kept redirecting me to google.com), but it works fine in IE 5.
Kuro5hin has started two new series of articles about relativity (History, Special Relativity) and projective geometry.
If neurological impairment is the cause of the autistic’s disabilities, Snyder wondered, could it be the cause of their geniuslike abilities, too? By shutting down certain mental functions—the capacity to think conceptually, categorically, contextually—did this impairment allow other mental functions to flourish? Could brain damage, in short, actually make you brilliant?
This Boston Globe article is probably the most negative thing Shira Springer has written about Celtics coach Jim O’Brien. Amazing.
I’m trying to make an HTML gallery of photos to burn to CD. iPhoto won’t let me export HTML because I don’t have .Mac. BetterHTMLExport changes the descriptive image names that I added to numbers. iView MediaPro, PageThing, PhotoPage, and Photoshop Elements don’t support long file names. Is it time for a Perl script?
VCs do not have goals that are aligned with the goals of the company founders. This creates a built-in source of stress in the relationship. Specifically, founders would prefer reasonable success with high probability, while VCs are looking for fantastic hit-it-out-of-the-ballpark success with low probability.
Tim Bray links to a study of online typefaces, which concludes that Verdana is good.
Pierre Igot writes about “tendency to design software for which the optimal running environment is a computer that does not exist yet.” It’s a real problem, although I disagree with one part of his article:
It is clear that Apple is quite aware that this is an issue. Otherwise, they would not have provided users with the option to turn drop shadows off in iPhoto 2. They would not have introduced the option to turn the Preview display off by default in Columns view in the Finder.
I turned off shadows in iPhoto because I don’t like the way they look, and I turned off previews in the Finder because of the way they interfere with scrolling and keyboard navigation.
Complexity may be a boon to software marketers looking to hype new features and “professionals” who get a thrill out of adding new certification acronyms to their email signature, but it’s bad for almost everyone else.
Nevin Liber gave a presentation at PSIG 65. He told his tale using T-Shirts he received while working at Apple. He graciously allowed me to photograph them, and I offer them here for your viewing pleasure.
James Duncan Davidson writes about the spread of PowerBooks and Mac OS X among the computing cognoscenti. That’s such an interesting transition for Apple. Years ago, Macs were used by creative professionals and in education. These days they’re unfortunately disappearing from a lot of schools, but those changes are being countered by increased consumer sales…and a rise in sales to folks like Duncan.
This is almost as effective as caffeine for helping me crank out code like mad, especially since I finally put ProjectBuilder into “many windows” mode once and for all. Now my principal development environment looks and feels like a real IDE rather than a clone of that Microsoft Visual Studio garbage everybody seems to think IDEs should be like these days…
Just say no to using laptops on your lap.
Great stuff from Rod Hilton (via Jamie Zawinski):
KEANU REEVES Who are you? THE EXPLAINER I am The Explainer. I designed the matrix screenplay. Unable to decently explain the convoluted plot well, I have resorted to putting myself here in the final act and having you ask all of the questions the audience wants to ask. (dramatic pause) You must begin by asking your own questions then gradually switch to asking those of the audience, in order to not make this scene any more awkward than it already is.
I forgot to mention that Mailsmith 2.0 is a free update. Here’s some more blog coverage of it:
Daniel Weise has gotten Microsoft’s Office group to use code annotations and domain specific checkers to catch bugs. His buffer overrun detector uses a dependent type system based on those annotations to turn buffer overruns into type errors.
Mike Swaine points to a report from Apple’s meeting with the independent music artists, which has some fun with statistics:
45% of all songs have been bought as an album. In other words: don’t worry about the death of the album format. 45% of people prefer to buy as an album anyway, even though they always have the option to only buy per-song.
Another way of looking at it would be to say that people are buying about ten times as many singles as albums. In other mathy book news, when I was in the airport last week I noticed that John Allen Paulos has a new book out, about the stock market. Paulos is also author of the classic A Mathematician Reads the Newspaper. No more book plugs for a while—I promise.
Aaron Hillegass and Mark Dalrymple have written what looks to be a more advanced book on Cocoa and Darwin, however the table of contents leaves me wondering. It spends 52 pages reviewing C, but only two pages on Rendezvous and five total on ObjectAlloc, Sampler, QuartzDebug, and CHUD (that’s Computer Hardware Understanding Development not the classic 1984 movie, although Hillegass’s other book does explain OO delegation in terms of Knight Rider). In any case, it seems to break some new ground for Cocoa books. Unfortunately, that doesn’t mean it covers AppleScript.
Have you ever switched from Graphite to Aqua to take screenshots and been surprised by how bright it is?
Andrew Pinski informed me that although not required to by the language standard, GCC 3.1 does optimize most tail calls in Objective-C. This gives a little performance boost for recursive algorithms coded in the right form (take a look with gcc -S
), and it can be the difference between correctness and a crash for deep recursions. Dan Sugalski has promised to discuss this at some point. GCC does not optimize tail calls in methods that catch exceptions or use AltiVec. Andreas Bauer’s master’s thesis describes how a future version of GCC may do better.
Tantek Çelik, a Tasman developer, has links to most of the posts. I don’t really have anything to add to the discussion.
Kent Dybvig’s The Scheme Programming Language is online. Also online is How to Design Programs by Felleisen et al, which I’ve not read, but which is said to be excellent. To try out the examples on Mac OS X, I recommend JScheme and DrScheme.
Jerry Kindall links to a great article by Theo Gray (the really enthusiastic guy who demoed Mathematica at a recent Macworld Expo) and Jerry Glynn. This brings to mind the famous Steve Jobs quote:
I used to think that technology could help education. I’ve probably spearheaded giving away more computer equipment to schools than anybody else on the planet. But I’ve had to come to the inevitable conclusion that the problem is not one that technology can hope to solve. What’s wrong with education cannot be fixed with technology. No amount of technology will make a dent.
I’ve got to admire Pierre Igot for writing a whole page about the brief hole in Mac OS X’s input buffer.
In the good old days of Mac OS 9, even if you clicked on something “in advance”, before the software was actually ready to process your click, your mouse click would be recorded in some kind of “buffer” and would be applied as soon as the software was ready. It was the same with keystrokes.
In Mac OS X, all too often, if you start clicking or typing something before the software is actually ready to register your actions, then what you’ve clicked or typed gets lost in unresponsive UI limbo forever.
It's irritating.
Igot also wrote an article about the intrusiveness of background processes.
As Rob Fleming would say: these things matter.
Dave Thomas tells how he did the code examples for the Ruby book in LaTeX.
Brent Simmons argues for Web pages with white space on either side of the text, saying that if the text goes from edge to edge he’ll have to make his window narrower in order to read it. I’m the opposite. I prefer pages with flush text so that I can use a narrow window to begin with and not waste any screen space. I don’t like seeing a horizontal scroll thumb that’s enabled only so that I can scroll to the right and see more white space. I find the layout of Daring Fireball particularly odd in that the width of the text doesn’t adjust to the font size. With a large font, there are too few words per line; with a small font, too many. Liquid layouts aren’t perfect, but they do give the reader an extra degree of freedom to play with.
Sven-S. Porst reviews Nick Hornby’s 31 Songs, which seems to be the U.K. version of Songbook.
Writing about music in an engaging or thought provoking way is hard—I mostly fail to do so and so do many writers in music magazines. While Nick Hornby may have the back-catalogue of knowledge, I don’t think he’s terribly good at writing about music. Furthermore, reading the book made clear to me that I appreciate Nick Hornby as a novelist and that I hardly care about anecdotes of his life.
For the record, I thoroughly enjoyed High Fidelity and About a Boy. The movies are good, too, but different. How to Be Good started out well, but then it got heavy handed and went nowhere.
Dan Sugalski looks at reference counting and garbage collection. It’s a nice, short introduction from a practical point of view. Garbage collection is a huge area of current research, with many PhD theses awarded to people who figure out how to make it faster and more deterministic.
I don’t actually use CVS with Project Builder, but this looks to be a useful guide if I ever get a developer account on SourceForge.
SpamSieve 1.3.1 and Mailsmith 2.0 are out. The SpamSieve update is minor. It's about making SpamSieve 1.3 a little faster, better, and smaller to tide people over to the next major release. Mailsmith 2.0 is a major update. Besides adding support for the Mac OS X Address Book, PGP, background queries, clickable links, digest bursting, better mailbox pop-ups, and a refined interface, it features direct integration with SpamSieve. No more AppleScripts or filters: enabling SpamSieve in Mailsmith is as easy as clicking a checkbox.
Bare Bones Software has seamlessly integrated SpamSieve with Mailsmith's powerful filtering system. You can choose what happens when you manually mark messages as spam or good. For instance, I have it set so that correcting a false positive re-applies Mailsmith's filters to the message, thus filing it in the proper folder. Mailsmith can automatically move spam messages to its (spam) folder, but if you want more control there are also new filter criteria called Is Spam and Is Not Spam. It sweats the details: Mailsmith knows not to bounce or animate its Dock icon after receiving a batch of messages that are all spam. You can also add an address to SpamSieve's whitelist by Control-clicking on the message's sender and choosing Add to Address Book from the contextual menu. For extra speed, Mailsmith sends SpamSieve decoded versions of the messages (there's no sense in both programs decoding them) and strips out large non-text attachments that can be slow to transfer through the Apple event pipe.
New purchases of Mailsmith between now and July 30 will include a free copy of SpamSieve, and there is an additional 10% discount if you order before June 30. SpamSieve continues to work with e-mail clients other than Mailsmith, and 1.3.1 adds some improvements specifically for users of Emailer, Entourage, Eudora, and PowerMail. Of course, if the developers of these or other clients wish to also provide direct integration with SpamSieve, the interface that Mailsmith and SpamSieve use to communicate is completely open. I would be happy to answer any questions that they have about it.
Someone at kuro5hin has written an exceptionally clear article about infinity and countably infinite sets.
Most sane individuals know that dynamic scoping is evil. However, it can be useful, and Dave Thomas shows that when made explicit it can actually be pretty nice. His code demonstrates some powerful Ruby features: using blocks to add syntax to the language and (ab)using callcc. Neither of these is possible in Python.
The way his first implementation works is that find_in_context
throws an exception that’s caught in with_context
. The exception stores a function that knows (a) the name being looked up, and (b) find_in_context
’s continuation. with_context
passes the function its context. If the context contains a binding for the name, the function calls the continuation with that value. This makes find_in_context
return the value to its caller. The use of continuations is totally gratuitous, as Thomas later shows.
Food for thought: since exception handlers are themselves dynamically scoped, this implementation is, in a sense, circular.
Dan Sugalski does a great job of explaining multimethods. And there’s more:
Haskell, for example, allows you to dispatch based on the values that are passed, as well as their types. This is a tremendously powerful mechanism, though one that’s not often implemented. (I have a nagging suspicion that’s as much because it becomes close to impossible to mathematically prove a program's correctness with this scheme as the cost, and the folks doing language research tend to be of a theoretical bent. I may be wrong, though)
I worked on a language that had where
clauses, a slight generalization of his example. You could say stuff say foo(a, b : Int) where a ~= b/2
or foo(e : E, l : Seq[E]) where e = head(l)
. The language was designed with theorem proving in mind. However, this does complicate some things. And what do you do if the where
clauses of the different methods aren’t disjoint?
Two more points:
singleton(5)
creates a type that’s a subtype of 5
’s type and whose only member is 5
. This makes it possible to dispatch by value. Dylan also lets you make new number types with limited ranges, but I don’t recall exactly how that works; presumably those are also taken into account during dispatch. Another fun way to use singleton types is to let the multimethod dispatch system do memoizing for you. You create a new method specialized on singleton types for the arguments you received, and put it in the dispatch table.Read any article about AppleScript and Cocoa (see Andrew Stone’s tutorial for example), and chances are you’ll be told right off the bat how easy it is, thanks to the wonders of key-value coding, to add AppleScript support to a properly designed application. What these experts might have forgotten, however, is that they’re right about it being easy—but only after you understand how to properly manipulate a bunch of fairly confusing XML!
Fortunately, there is Suite Modeler, which is much better than editing XML by hand. Unfortunately, it seems to be designed for screens the width of the Cinema Display and always leaves its daemon running.
Having everything in an object database is cool until you start using it. Then you realize that you’ve lost all your existing toolchain to manipulate data on a UNIX box. grep? sed? find? All gone. vim? haha good luck.
This is essentially the other side of the Power of Plain Text. Of course, this is not to say that everything should be plain text, just that there are tradeoffs. Funny (perhaps) story: a while ago I was designing a format for serialized objects. Efficiency wasn’t the primary concern, so I picked sexps. We already had code to generate and parse them, and they could easily be manipulated with Emacs and diff’d by the regression tests. I started pitching this using my (I guess) Mac vocabulary of text files vs. binary files. Josh’s first comment: text files are binary, too.
Keith Devens says that namespaces don’t solve a real problem:
Well, if a computer can’t divine what to do with a piece of XML without having code written by a human process it—the human’s mind is the only place where the “meaning” of the XML can be said to be known, not in some “schema”—then what does the namespace give us (besides a headache)? I say nothing.
I’m just sick of everybody trying to write some labels down (that’s all an XML document is) and claim that it has some “meaning” apart from a mind understanding it.
The June issue of ATPM is out. Most pertinent to my writing here is Evan Trent’s article about jumping from OS 9 to Jaguar. Evan is ATPM’s Technical Wizard, and he knows Mac OS 9 inside out. But since he’s got a non-computer business to run, he wasn’t going to switch to Mac OS X just because it had a higher version number. Now that he’s made the jump, he has a fresh perspective on OS X that’s a little different from that of those of us who’ve been trying every version since the Apple was in the center of the menu bar.
Elliotte Rusty Harold and Bill Venners discuss five styles of XML APIs.
Neither Apple nor Microsoft invented many of the technologies that they brought to prominence. So “innovator” in that sense is perhaps exaggerated. But what Apple does so well is to realize the potential in a technology, and to frame it in such a way that people discover that they need it. In a way, they are cultural innovators more than they are tech innovators.
Finding Nemo is Pixar’s most visually stunning film and employs some great vocal talent, but it’s not excellent as a movie. The characters aren’t as engaging, and the script isn’t as sharp. Blue Memento fish would have made a great bit character, but as a lead she’s more annoying than Jar Jar Binks.
I loved the short about the snowman, though.
Here’s how I’d rank Pixar’s films (as films):
Chris Sells has posted some interesting comments about life as a new Microsoft hire.