Return-Path: Delivered-To: apmail-incubator-thrift-dev-archive@locus.apache.org Received: (qmail 8502 invoked from network); 11 Jun 2008 07:52:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Jun 2008 07:52:13 -0000 Received: (qmail 60580 invoked by uid 500); 11 Jun 2008 07:52:16 -0000 Delivered-To: apmail-incubator-thrift-dev-archive@incubator.apache.org Received: (qmail 60566 invoked by uid 500); 11 Jun 2008 07:52:16 -0000 Mailing-List: contact thrift-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: thrift-dev@incubator.apache.org Delivered-To: mailing list thrift-dev@incubator.apache.org Received: (qmail 60543 invoked by uid 99); 11 Jun 2008 07:52:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jun 2008 00:52:16 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.200.173] (HELO wf-out-1314.google.com) (209.85.200.173) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Jun 2008 07:51:25 +0000 Received: by wf-out-1314.google.com with SMTP id 28so3665188wff.21 for ; Wed, 11 Jun 2008 00:51:41 -0700 (PDT) Received: by 10.143.28.8 with SMTP id f8mr2475857wfj.270.1213170700504; Wed, 11 Jun 2008 00:51:40 -0700 (PDT) Received: by 10.142.110.12 with HTTP; Wed, 11 Jun 2008 00:51:40 -0700 (PDT) Message-ID: Date: Wed, 11 Jun 2008 00:51:40 -0700 From: "Patrick Collison" To: "Mark Slee" Subject: Re: Common Lisp port Cc: thrift-dev@incubator.apache.org In-Reply-To: <1DCCB325C9C9BA4A8BB7C7115110AF937E76E6@Sf2pmxb04.TheFacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1DCCB325C9C9BA4A8BB7C7115110AF937E76E6@Sf2pmxb04.TheFacebook.com> X-Virus-Checked: Checked by ClamAV on apache.org On Mon, Jun 9, 2008 at 3:20 PM, Mark Slee wrote: > I'm not sure the attachment made it through. (Was it a file or a link? > Maybe the Apache list doesn't like that...) Hmm, seems like it didn't. It's now at http://collison.ie/code/thrift-cl.patch. Cheers, Patrick > Sounds like a cool implementation, and I don't think it violates the > spirit of Thrift since this sounds like a somewhat natural thing to do > in the Lisp world for compatibility. > > -----Original Message----- > From: Patrick Collison [mailto:patrick@collison.ie] > Sent: Monday, June 09, 2008 1:26 AM > To: thrift-user@incubator.apache.org > Subject: Common Lisp port > > Hey, > > Attached is a port to Common Lisp. > > It's fairly rough, but since it's now good enough for my uses, I'm > releasing it in case I never get around to cleaning it up fully. > > Some implementation notes: > - It supports both client and server use. > - It depends on Allegro Common Lisp for reading and writing floats (CL > has no portable way of doing this), but adding support here for other > implementations will be trivial. > - It requires ASDF (a Common Lisp packaging system), and depends on the > usocket and trivial-utf-8 libraries. > - The generator works by translating the Thrift IDL to s-expressions > (you can see tutorial.thrift's form at > http://collison.ie/code/thrift-tutorial.lisp), and then doing the actual > compilation in Lisp. Though this compilation will happen every time the > source file is loaded, it's very fast: using Allegro, it takes me around > 10 msec total to compile shared.thrift and tutorial.thrift. Doing the > compilation at load-time is arguably against the spirit of Thrift, but > in practice this approach works quite nicely with CL. Since source-files > are only loaded once per session (which, in deployed systems, tend to > run for days/months), the overhead is negligible, and greatly outweighed > by the advantages (simpler code, more compile-time optimisation). It's > worth pointing out that the load-time compilation is also completely > transparent to the user, and the code generated by the C++ compiler can > be loaded as if it were ordinary Lisp code (indeed, thanks to macros, it > is). > - There's actually another big reason for the intermediate s-exp > approach -- it means ports to Scheme/Arc/Your Favourite Lisp Dialect can > be done without any new C++ generator code. > - It's the smallest port by a fairly large margin -- 892 non-blank lines > total (325 lines of C++, 567 lines of CL). By contrast, Haskell > (say) is 1730 (1285 C++, 445 Haskell), and Ruby is 1845 (848 C++, 997 > Ruby). > > Feedback and improvements are of course welcome. > > Cheers, > > Patrick >