From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Kjetil S. Matheussen" Newsgroups: gmane.lisp.guile.user Subject: Re: Passing C pointers through guile Date: Thu, 10 Jul 2008 14:54:49 +0200 (CEST) Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary_(ID_2jNGtnHbzRIGk/bkjOGJMw)" X-Trace: ger.gmane.org 1215694600 23158 80.91.229.12 (10 Jul 2008 12:56:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 10 Jul 2008 12:56:40 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Jul 10 14:57:26 2008 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KGvi5-0008VA-O9 for guile-user@m.gmane.org; Thu, 10 Jul 2008 14:57:22 +0200 Original-Received: from localhost ([127.0.0.1]:50709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KGvhE-000359-8l for guile-user@m.gmane.org; Thu, 10 Jul 2008 08:56:28 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KGvh9-000352-6W for guile-user@gnu.org; Thu, 10 Jul 2008 08:56:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KGvh7-00034q-Kt for guile-user@gnu.org; Thu, 10 Jul 2008 08:56:21 -0400 Original-Received: from [199.232.76.173] (port=42186 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KGvh7-00034n-Fe for guile-user@gnu.org; Thu, 10 Jul 2008 08:56:21 -0400 Original-Received: from smtp.getmail.no ([84.208.20.33]:36170) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KGvh6-0002wh-W4 for guile-user@gnu.org; Thu, 10 Jul 2008 08:56:21 -0400 Original-Received: from pmxchannel-daemon.no-osl-m323-srv-004-z2.isp.get.no by no-osl-m323-srv-004-z2.isp.get.no (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) id <0K3S00I01JXGNA00@no-osl-m323-srv-004-z2.isp.get.no> for guile-user@gnu.org; Thu, 10 Jul 2008 14:56:04 +0200 (CEST) Original-Received: from smtp.getmail.no ([10.5.16.1]) by no-osl-m323-srv-004-z2.isp.get.no (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTP id <0K3S005JDJVFTSA0@no-osl-m323-srv-004-z2.isp.get.no> for guile-user@gnu.org; Thu, 10 Jul 2008 14:54:51 +0200 (CEST) Original-Received: from cm-84.215.136.96.getinternet.no ([84.215.136.96]) by no-osl-m323-srv-009-z1.isp.get.no (Sun Java System Messaging Server 6.2-7.05 (built Sep 5 2006)) with ESMTP id <0K3S008HGJVFZAZ5@no-osl-m323-srv-009-z1.isp.get.no> for guile-user@gnu.org; Thu, 10 Jul 2008 14:54:51 +0200 (CEST) X-X-Sender: kjetil@ttleush X-detected-kernel: by monty-python.gnu.org: Solaris 10 (beta) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:6638 Archived-At: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --Boundary_(ID_2jNGtnHbzRIGk/bkjOGJMw) Content-type: TEXT/PLAIN; charset=iso-8859-1; format=flowed Content-transfer-encoding: QUOTED-PRINTABLE Ludovic Court=E8s: > > Sure, if you just do this now and then, SMOBs aren't a problem. > > But that doesn't change the fact that all the functionality SMOB > > provides is overkill when the only thing you need is to hold > > a pointer. >=20 > It's not overkill, it's exactly what you need: disjoint SMOB type, > `free' and `mark' procedures. My point is that SMOB's are overkill if you _don't_ need either free or=20 mark. > > For those who needs the full functionality of SMOB's, or need > > the extra speed and memory advantages of SMOB's, they are free > > to use SMOB's. If not, the functions scm_to/from_uintptr > > can be used instead, which is a billion times easier to use. >=20 > Not really: as mentioned on `guile-devel', you'll need to implement that > functionality (disjoint type, garbage collection) on top of your > integer. One advantage is that this can be done in Scheme (except for > the `mark' procedure, but it's not always needed); the main drawback in > the context of Guile is poor performance. I'm just copying my answer to the guile-devel mailing list: " Point is that you very often don't need any kind of free functionality. For example, if you create a gui widget, you probably have a callback function which is called if the gui is closed. That callback function can free any allocated memory. Another example from snd is creating ladspa plugins (audio plugins in linux). Handlers from those, plus variuos configuration stuff, is alive througout the whole session and will be automatically freed when the program closes. " --Boundary_(ID_2jNGtnHbzRIGk/bkjOGJMw)--