From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: make-vtable Date: Thu, 15 Feb 2007 09:45:27 +0100 Organization: LAAS-CNRS Message-ID: <8764a3kdw8.fsf@laas.fr> References: <877iunt6yl.fsf@zip.com.au> <87r6suv5k2.fsf@laas.fr> <877iulwxzd.fsf@zip.com.au> <871wktrwur.fsf@laas.fr> <87tzxopinw.fsf@zip.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1171529142 4079 80.91.229.12 (15 Feb 2007 08:45:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 15 Feb 2007 08:45:42 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Feb 15 09:45:36 2007 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.50) id 1HHcFD-0007cY-15 for guile-devel@m.gmane.org; Thu, 15 Feb 2007 09:45:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HHcFC-00054Q-JY for guile-devel@m.gmane.org; Thu, 15 Feb 2007 03:45:34 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HHcF7-00054K-Af for guile-devel@gnu.org; Thu, 15 Feb 2007 03:45:29 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HHcF6-000548-Ef for guile-devel@gnu.org; Thu, 15 Feb 2007 03:45:28 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HHcF6-000545-8n for guile-devel@gnu.org; Thu, 15 Feb 2007 03:45:28 -0500 Original-Received: from laas.laas.fr ([140.93.0.15]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1HHcF5-00065F-Mg for guile-devel@gnu.org; Thu, 15 Feb 2007 03:45:28 -0500 Original-Received: by laas.laas.fr (8.13.8/8.13.8) with SMTP id l1F8jNwk010871; Thu, 15 Feb 2007 09:45:24 +0100 (MET) X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 27 =?iso-8859-1?Q?Pluvi=F4se?= an 215 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu Mail-Followup-To: guile-devel@gnu.org In-Reply-To: <87tzxopinw.fsf@zip.com.au> (Kevin Ryde's message of "Thu, 15 Feb 2007 07:51:15 +1100") User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) X-Spam-Score: 0.307 () MAILTO_TO_SPAM_ADDR X-Scanned-By: MIMEDefang at CNRS-LAAS on 140.93.0.15 X-MIME-Autoconverted: from 8bit to quoted-printable by laas.laas.fr id l1F8jNwk010871 X-detected-kernel: Solaris 10 (beta) 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:6526 Archived-At: Hi, Kevin Ryde writes: > ludovic.courtes@laas.fr (Ludovic Court=E8s) writes: >> >> I'm not sure the indirection in `scm_init_stacks ()' is needed since i= t >> uses STACK_LAYOUT for both VTABLE and SCM_STACK_TYPE, > > Not sure what you mean there. We have: VTABLE -> SCM_STACK_TYPE -> stack objects where `x -> y' means "`y' is an instance of `x'". When creating stack objects with (roughly) `(make-struct stack-type)', VTABLE is _not_ consulted at all. The layout of stack objects is determined only by that specified in SCM_STACK_TYPE. Thus, VTABLE is redundant. All this would be clearer if we had a `struct-vtable' type such that `(make-struct struct-vtable)' would yield a new vtable (just like `(make )' yields a new GOOPS class). Like `', `struct-vtable' would terminate the "reflective tower" (i.e., its vtable is itself). Actually, such a `struct-vtable' stealthily appears in `make-vtable-vtable', under the name of REQUIRED_VTABLE_FIELDS: We could really have a `struct-vtable' whose layout is REQUIRED_VTABLE_FIELDS and then `make(-vtable)+' could be simply implemented in terms of `make-struct' (just like `make-class' uses `make'). I guess I should try implementing this theory one of these days. ;-) > At any rate, below is where I'm up to so far with trying to make the > docs a bit easier. It includes my proposed make-vtable. Could be > possible to leave that out, but perhaps those like me who managed to > never understand structs can see if it makes the understanding easier > :-). Thanks for working on this! > A "structure" is a first class data type which holds Scheme values or C > words in slots numbered 0 upwards. A "vtable" represents a structure > type, giving read/write permissions on slots, whether they're Scheme > values or uninterpreted words, and giving an optional print function > for the structure (for use by `write' etc). Perhaps a word saying the struct fields are laid out in a contiguous memory area, which makes interaction with C much easier (using C arrays or some such). > Vtable Vtables > .............. > > As noted above, vtables are structures and such a structure is itself > described by a vtable. Such a "vtable of a vtable" can be created with > `make-vtable-vtable' below and used to build sets of related vtables, > possibly with extra application fields. > > This second level of vtable can be a little confusing. An example, > and indeed a typical use, is Guile's own record system (*note > Records::). Currently record types are implemented as vtables, and > those vtables have an extra slot holding the list of field names for > that type (as passed to `make-record-type'). While the rest looks good, I remain skeptical about this part. And a manual that claims to be confusing does not inspire confidence. ;-) Thanks, Ludovic. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel