?

Log in

No account? Create an account

I'm a Busy Bee

Apis 1.0 is now ready to go. You can get it here.

Apis 1.0 is essentially the same application as Atta 1.0, but written in Common Lisp, using Clozure Common Lisp, instead of being written in Scheme using Gambit-C. The structure, appearance, and behavior of the two applications is nearly identical, so they may provide useful illustrations of the differences between Cocoa development using CCL versus using Gambit.

There are various superficial differences that you might notice right away. One is that Atta.app is about 7.5MB, while Apis.app is about 34MB. The size difference basically reflects the difference in features built into Common Lisp versus those of Scheme. Scheme is a much more compact language, which has its pluses an minuses. On the one hand, the Scheme application is much smaller. On the other hand, a developer will wind up reinventing more wheels (or hunting the net for someone else's version of a wheel).

Another obvious difference is that there are no Objective-C source files in the Apis distribution. It doesn't need them, because CCL's Objective-C bridge provides everything you need to define Cocoa classes and methods. That's an important point to some people; they want to be able to write a Cocoa app without having to see C code. CCL offers you that option, at the cost of having to learn the Objective-C-in-Lisp language of CCL's bridge. With Gambit, you must write your Objective-C code in C, but Gambit makes that easy to do. With CCL, on the other hand, you can write your Objective-C code in Lisp--but don't fool yourself; it's still basically Objective-C code, and you still have to learn Cocoa. Not that I'm complaining, mind you; if you're going to write Cocoa apps, you're going to have to learn Cocoa, no matter what language you use.

A fussier detail is that the build process of the two projects is a little different. Both use Makefiles, and I;ve packaged them to be about as similar in structure as is reasonable, but Atta uses Gambit and, through it, Apple's C compiler. Apis, on the other hand, uses CCL to compile, and Apple's C compiler is never involved. (Don't take that to mean you can build Apis without Apple's developer tools. Even if you replaced the Makefile with a Lisp program, you'd need Apple's ibtool to compile the resources for the bundle.)

The Atta source code is in three Scheme files and four Objective-C files. The Apis code is in five Lisp files. Ata is 260 lines of code total. Apis is 247. Apis launches in about a quarter of a second on my iMac; Atta launches in a bout a third of a second. Atta builds in about six seconds. Apis takes about nine.

For Apis, you'll need a recent install of Apple's developer tools, and a recent release of Clozure Common Lisp. I tested with XCode 3.2 and CCL 1.4.

Enjoy!

Comments

(Anonymous)

Makefile

Mikel,

if you'd set CCL_DIR to $${CCL_DEFAULT_DIRECTORY-/usr/local/src/ccl} in Makefile, that'd probably work for many people out of the box.

Re: Makefile

Maybe. It certainly wouldn't work for me. Some of the other CCL contributors keep various CCL directories around as well, but maybe the wider world of CCL users is less variegated.

(Anonymous)

Size

Mikel, great stuff, thanks!

What about the size? Is the usual development image of Clozure CL really needed? How about a smaller image without source locations, debug symbols, arglists, documentation strings and unused parts removed?

Re: Size

You can definitely reduce the size of the image, but it's not simple, and should be undertaken with caution. Keep in mind that CCL comes with everything you need to rebuild it from source code (except the Apple Dev Tools, of course). It's straightforward enough to start a CCL session and use Meta-. to find the definition of rebuild-ccl. From there you can start walking your way through the CCL code that bootstraps the Lisp, and you can try amputating parts of the runtime.

Paring down a Lisp system is a bit of a black art, because you can't always be sure you've correctly understood what parts of the working system depend on what other parts. But if you start with the order in which CCL loads its subsystems, and begin by removing the ones at the end, you might make some headway.

On the other hand, a short way into this process, you may find yourself wondering whether all that work is really worth the effort to clip a few MB off your application in an era when live RAM is measured in GB.

February 2010

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
28      
Powered by LiveJournal.com