From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: Re: FFI and disjoint types Date: Mon, 01 Mar 2010 20:49:58 +0000 Message-ID: <87hbozvkax.fsf@ossau.uklinux.net> References: <87sk8kgm5o.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1267476628 22300 80.91.229.12 (1 Mar 2010 20:50:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Mar 2010 20:50:28 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Mar 01 21:50:24 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NmCZL-0006Pk-Fg for guile-devel@m.gmane.org; Mon, 01 Mar 2010 21:50:23 +0100 Original-Received: from localhost ([127.0.0.1]:47656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmCZL-00050l-24 for guile-devel@m.gmane.org; Mon, 01 Mar 2010 15:50:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmCZH-0004yC-Hu for guile-devel@gnu.org; Mon, 01 Mar 2010 15:50:19 -0500 Original-Received: from [140.186.70.92] (port=35435 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmCZG-0004xM-MX for guile-devel@gnu.org; Mon, 01 Mar 2010 15:50:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NmCZE-00045V-9E for guile-devel@gnu.org; Mon, 01 Mar 2010 15:50:18 -0500 Original-Received: from mail3.uklinux.net ([80.84.72.33]:47559) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NmCZE-000456-4n; Mon, 01 Mar 2010 15:50:16 -0500 Original-Received: from arudy (host86-182-154-126.range86-182.btcentralplus.com [86.182.154.126]) by mail3.uklinux.net (Postfix) with ESMTP id B34291F6AFC; Mon, 1 Mar 2010 20:50:14 +0000 (GMT) Original-Received: from arudy (arudy [127.0.0.1]) by arudy (Postfix) with ESMTP id 31E1E38026; Mon, 1 Mar 2010 20:49:59 +0000 (GMT) In-Reply-To: <87sk8kgm5o.fsf@gnu.org> ("Ludovic =?iso-8859-1?Q?Court=E8s?= =?iso-8859-1?Q?=22's?= message of "Mon, 01 Mar 2010 15:18:59 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10006 Archived-At: ludo@gnu.org (Ludovic Court=A8=A8s) writes: > Hello, > > The nice thing about SMOBs is that they allow disjoint C types to be > mapped to disjoint Scheme types. > > With =A1=AE(system foreign)=A1=AF, C pointers are mapped to Scheme foreign > objects, regardless of the type of object pointed to. Thus, to get > disjoint types in Scheme, foreign objects would need to be boxed in > structs (since structs are the only way to create disjoint types from > Scheme). > > If this analysis is correct, the resulting code may be somewhat > inefficient since we end up boxing C pointers twice. > > Is this correct? Thoughts? Sounds reasonable. Perhaps (system foreign) could add a way of declaring foreign pointer types, and of allowing code to state the type of a pointer at the time of boxing it. Neil