From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: persistant state in guile-log Date: Wed, 27 Jan 2016 09:13:30 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113abb00a61523052a4c6014 X-Trace: ger.gmane.org 1453882429 7418 80.91.229.3 (27 Jan 2016 08:13:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Jan 2016 08:13:49 +0000 (UTC) To: guile-devel , "guile-user@gnu.org" Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jan 27 09:13:48 2016 Return-path: Envelope-to: guile-devel@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 1aOLEa-0007iV-Kv for guile-devel@m.gmane.org; Wed, 27 Jan 2016 09:13:48 +0100 Original-Received: from localhost ([::1]:48526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOLEW-0007ha-I6 for guile-devel@m.gmane.org; Wed, 27 Jan 2016 03:13:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOLEN-0007en-Cz for guile-devel@gnu.org; Wed, 27 Jan 2016 03:13:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOLEM-0002kM-9T for guile-devel@gnu.org; Wed, 27 Jan 2016 03:13:35 -0500 Original-Received: from mail-qg0-x22a.google.com ([2607:f8b0:400d:c04::22a]:36686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOLEJ-0002jn-GA; Wed, 27 Jan 2016 03:13:31 -0500 Original-Received: by mail-qg0-x22a.google.com with SMTP id e32so814289qgf.3; Wed, 27 Jan 2016 00:13:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=EBYN8Z9Ankm28r5bOE0+peFPJfs4dHAzAcST7q9c22s=; b=WUICv4gckGBZPGv+pbxuL+q96bSHvV+9Y3/8WpFA/f5Y1sqPBtOn3e9Q1nTf/q7IlI JMQIgLnsbtiwz82VjcOxOXl0mf1q1eSx7/am6p1MsuuggkAj4U51QRLnDR6vi6zWmJ9Y 0Kcq7BEGVtEu4QRgZDZmaWWSSvbh3XT69GLoaQyPLXwdGZcX3vKU4OQSFNb9WAYjotID poRF5dAx7CdrIs9KxoubbtpN/Z2zlf6nbR0fXnJaaeq7eCZI+dVTZfk9I7LeaKnkvM4q LsP4A1ePnacFfbjiTcEd8yVC64hC/cWdWGsX4SYYbl7v0Aa/QxWu2N8wgihP9b2XSMOs N+XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=EBYN8Z9Ankm28r5bOE0+peFPJfs4dHAzAcST7q9c22s=; b=TX922rqCOoyhEAqfeS9bSoVRt5IBKa92qVQ0kxxEEWK6/XeYTfEn5OW+Lc8Q0L4zBg VUWbMTENN7R4Q5SrJAedBoiHpvhJeRDu5bmxNtoABawXnfgNUrYezzRCgMsXIeOqnsID FvQCE/0aohXKRcwly41rlnrN1Sdn4c1F8GgbmDSYN8q0JBbqL2ti18ya8mJeFQQ+aTs1 suHkPWExIGn/eu4WyNGbdNepAp1C7LdlXXih5d+KHJEGUlt28Fq1HapzUrADk0f0euZX LlBoLNY9TaP1CJ41vmgOg9hyr2l4vGd82UvbUpJ7rxUBC7/fwuwTTxyaPiA0t2qKBRap 9lwA== X-Gm-Message-State: AG10YORMzjAOA7uDm+IiwJEmdGgobHYoI5hOMItd9Drowdn+KPjVMIofrYLTrc89Uj9Y9lWtiz0WxsJZDfiKjA== X-Received: by 10.140.176.206 with SMTP id w197mr34478280qhw.59.1453882410929; Wed, 27 Jan 2016 00:13:30 -0800 (PST) Original-Received: by 10.55.174.70 with HTTP; Wed, 27 Jan 2016 00:13:30 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c04::22a X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:18135 gmane.lisp.guile.user:12314 Archived-At: --001a113abb00a61523052a4c6014 Content-Type: text/plain; charset=UTF-8 Hi all, In guile 2.1 the position of code segements are fixed relative certain vectors and this makes it possible to store indexes of code segements and as a possibility to persist closures. I took advatage of this because state in guile-log means that we must do exactly that. Persist not only datastructures like struct lists and vectors vhashes etc, but also persist closures. So now one can do cool things in guile-prolog like: prolog> X=1,stall,Y=2. prolog> .setp 1 prolog> .savep prolog> .quit stis> guile-prolog prolog> .loadp prolog> .refp 1 prolog> .cont X=1 Y=2 prolog> This is the interface: --------------------------------------------------------------------- (.setp ) associate current state to key (.refp ) instate state referenced by key to current state (.savep ) save all referenced states to disk (.loadp ) load new referenced states from disk (.cont ) continue a stalled predicate from current state I can make this persistant code into a library anyone interested? Oh the security implications of this is horrible but I don't pretend that guile-log is secure so I don't care. What's more demading is that it depends on groveling into guile internal datastructures. Therefore I am reqesting an official way of persisting closures. What's your take on that? Would you guy's want to supply such a mechansim or is it bad practice? regards Stefan --001a113abb00a61523052a4c6014 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi all,

In guile 2.1 the position of co= de segements are fixed relative certain vectors and this makes it
possible to store indexes of code segements and as a possibility to persis= t closures. I took advatage of this because state in guile-log means that w= e must do exactly that. Persist not only datastructures like struct lists a= nd vectors vhashes etc, but also persist closures. So now one can do cool t= hings in guile-prolog like:

prolog> =C2=A0X=3D1,stall,Y=3D2.
prolog> .setp 1
prolog> = .savep
prolog> .quit

stis> g= uile-prolog
prolog> .loadp
prolog> =C2=A0.refp 1
prolog> .cont

<= /div>
=C2=A0 X=3D1
=C2=A0 Y=3D2

prolog>
This is the i= nterface:
------------------------------------------------------= ---------------
(.setp =C2=A0 =C2=A0 =C2=A0= =C2=A0) <key> =C2=A0 =C2=A0 =C2=A0 associate current state to key
(.refp =C2=A0 =C2=A0 =C2=A0 =C2=A0) <key&g= t; =C2=A0 =C2=A0 =C2=A0 instate state referenced by key to current state
(.savep =C2=A0 =C2=A0 =C2=A0 ) =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 save all referenced states to disk
(.loadp =C2=A0 =C2=A0 =C2=A0 ) =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 load new referenced states from disk
(.cont =C2=A0 =C2=A0 =C2=A0 =C2=A0 ) =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 continue a stalled predicate from current state

I can make this persistant code into a library anyone interested?

Oh = the security implications of this is horrible but I don't pretend that = guile-log is secure so
I don't car= e. What's more demading is that it depends on groveling into guile inte= rnal datastructures. Therefore I am reqesting an official way of persisting= closures. What's your take on that? Would you
guy's want to supply such a mechansim or is it bad practic= e?

regards
Stefan
--001a113abb00a61523052a4c6014--