From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: procedure-source availability Date: Sun, 07 Oct 2012 22:36:58 +0200 Message-ID: <878vbi3tp1.fsf@gnu.org> References: <506910C0.7060108@netris.org> <87y5jp9de5.fsf@gnu.org> <87txuakouv.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1349642231 17685 80.91.229.3 (7 Oct 2012 20:37:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Oct 2012 20:37:11 +0000 (UTC) Cc: guile-user@gnu.org To: Panicz Maciej Godek Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Oct 07 22:37:14 2012 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TKxb8-0002Wd-6o for guile-user@m.gmane.org; Sun, 07 Oct 2012 22:37:14 +0200 Original-Received: from localhost ([::1]:50538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKxb2-0004ZM-8f for guile-user@m.gmane.org; Sun, 07 Oct 2012 16:37:08 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKxax-0004ZG-SG for guile-user@gnu.org; Sun, 07 Oct 2012 16:37:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKxaw-0000jP-QQ for guile-user@gnu.org; Sun, 07 Oct 2012 16:37:03 -0400 Original-Received: from xanadu.aquilenet.fr ([88.191.123.111]:60756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKxaw-0000jB-Hr for guile-user@gnu.org; Sun, 07 Oct 2012 16:37:02 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id 3237D2C36; Sun, 7 Oct 2012 22:37:00 +0200 (CEST) Original-Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ukFzsewyU0NB; Sun, 7 Oct 2012 22:37:00 +0200 (CEST) Original-Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 82BB22826; Sun, 7 Oct 2012 22:36:59 +0200 (CEST) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 16 =?iso-8859-1?Q?Vend=E9miaire?= an 221 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu In-Reply-To: (Panicz Maciej Godek's message of "Sun, 7 Oct 2012 02:07:20 +0200") User-Agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 88.191.123.111 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:9612 Archived-At: Hello! Panicz Maciej Godek skribis: > Well, the problem is that I don't yet know what I am doing, so I'm > trying to keep the system as general as possible. One of the features > that is certainly going to be needed anyway, is a way to store and > restore lambdas, because this is the essential abstraction mechanism > of Scheme. Maybe some separate layer for GUI description will emerge > later on, but the task that I assigned to myself seems worth exploring Yeah. Scheme allows you to create the =E2=80=9Cessential abstraction mecha= nism=E2=80=9D that you like best anyway. :-) [...] >> The (oop goops save) module implements parts of a serialization >> framework. When GOOPS is loaded, any Scheme object is a GOOPS instance, >> so one could define methods to serialize any type of object. > > It looks interesting, but I somehow can't get it to run, even for very > simple cases: [...] > Besides this, it looks similar to the thing I'm working on, so if I > get far enough, then perhaps my results could be incorporated into > that framework? (It requires some labour though, as there are many > types to be considered Yes, that=E2=80=99s what I had in mind. :-) [...] >> Note that this doesn=E2=80=99t make =E2=80=98self=E2=80=99 a reserved ke= yword; instead, it=E2=80=99s >> just a local variable that cannot be referred to by name in BODY, thanks >> to the macro hygiene rules. > > Yes, you're right. > I even went a little further with that and now I also capture lexical > environment: > (use-modules (system syntax) (ice-9 local-eval)) > > (define-macro (function args . body) > `(let ((environment (the-environment)) > (lexical-names (lexical-names)) > (procedure (lambda ,args ,@body))) > (set-procedure-property! procedure 'source '(function ,args ,@body)) > (set-procedure-property! procedure 'environment environment) > (set-procedure-property! procedure 'lexical-names lexical-names) > procedure)) > > (where ``lexical-names'' returns the car-s of ``lexicals'', as defined > at the bottom of > http://www.gnu.org/software/guile/manual/html_node/Syntax-Transformer-Hel= pers.html#Syntax-Transformer-Helpers > ) > > So in addition to the source of the procedure, the lexical environment > can also be retrieved: > > (define (procedure-lexicals proc) > (map (lambda(symbol) > (cons symbol > (local-eval symbol (procedure-property proc 'environment))= )) > (procedure-property proc 'lexical-names))) I don=E2=80=99t want to sound too dogmatic, but I think you really don=E2= =80=99t want to take that route. ;-) The issues with =E2=80=98local-eval=E2=80=99 have been discussed at length = a year ago or so on guile-devel. Basically, the problem is that it plays badly with compilation, and there are usually nicer way to achieve what you want. HTH, Ludo=E2=80=99.