Sunday, January 27, 2008

Smoothing the way


Periodically, I like to ego-surf to find out what people think of Cusp. It's usually complimentary, which is always nice to see (even if they tend to call it "CUSP"), but I like to keep a special eye out for people who are having issues, since that usually points me toward ways I can improve the experience for people.

Recently, I ran into this post. The author had a load statement in his file that just wasn't working. Why? Because he was calling it merely "file.lisp." No absolute path was given, and since sbcl is almost certainly not being run in the same directory as that file, it's not going to be able to find it without more information.

The sad part for me is that I'm not entirely sure there's much I can do for this kind of problem. Firstly, a person could very easily have multiple projects going at the same time, so determining the proper working directory is a chancy thing. Even then, automatically shifting working directories is the kind of anti-feature that soon causes more trouble than it saves.

This isn't an issue isolated to this one guy, though. Judging from the comments and recent posting on the Cusp discussion boards, others have tried to do the same thing. I think the real answer here is actually to educate people on the usage of asd files, and to get them to treat them as project files. I intend to add some comments to the auto-generated asd files to get people on the right track, but that's probably the best I can do.

Sadly, I couldn't resolve that issue technologically, but I was able to do something about one of the comments on that entry. The problem? When you create a new project, Cusp automatically wraps it all into a new package. Once you know what you're doing, this a very nice thing, because it is what you should be doing anyway. But when you're completely fresh to Lisp, you're not likely to realize that the stuff in the file is going to one package, while the Repl is sitting in another.

The fix was easy. Now when you make a new project, the REPL is automatically switched to that project's package. 99% of the time, this is what you'll want to do, and it should allow newbies to experiment without first having to learn all about the packaging system.

No comments: