From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andrew Gaylard Newsgroups: gmane.lisp.guile.devel Subject: Re: persistant state in guile-log Date: Wed, 27 Jan 2016 10:51:30 +0200 Message-ID: <56A88512.7070006@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------090609080201020803030007" X-Trace: ger.gmane.org 1453898286 5478 80.91.229.3 (27 Jan 2016 12:38:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Jan 2016 12:38:06 +0000 (UTC) To: Stefan Israelsson Tampe , guile-devel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jan 27 13:38:01 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 1aOPMG-0008Oc-VL for guile-devel@m.gmane.org; Wed, 27 Jan 2016 13:38:01 +0100 Original-Received: from localhost ([::1]:50178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOPMG-0004V5-G1 for guile-devel@m.gmane.org; Wed, 27 Jan 2016 07:38:00 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOLpF-00080y-3g for guile-devel@gnu.org; Wed, 27 Jan 2016 03:51:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOLpB-0003Up-SZ for guile-devel@gnu.org; Wed, 27 Jan 2016 03:51:41 -0500 Original-Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:37480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOLpB-0003Th-FI for guile-devel@gnu.org; Wed, 27 Jan 2016 03:51:37 -0500 Original-Received: by mail-wm0-x231.google.com with SMTP id n5so15226695wmn.0 for ; Wed, 27 Jan 2016 00:51:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type; bh=R6TG+ypqAQKjbZcnxwmosuwQzjvvZ9ny8TAHSM7zwTI=; b=grxG7evXNE2u05ejh/HBdK9F6Vs7B12Pa4ROt5TdLYu1sdqZH9QmpOrV/Ty8NLJm0V GlP2KYxduAap3E10eP++BuDOUgZhAvdyEyMoNBBSDP5VYlwTGCo8BSELuvID0crJbjeO Bqs53LYlUpIHZQhXgnglTR5hm5nd+nYY0h1eDas9jymteBQEgJI08DZKdNUSb9/v4agA ZDzoA/23U0QwL0vwKAmXfeOnJWYYiBO3x6j/zmLATqB83dYJNhCFNl9B9wtXGWalk8SW xTqqKzR9Ejibd+xAIDI87MsHMtvhYbhjDz1dXaINdpZDyJkH5Xjl6Q8uVd/8shZ6ccj+ mLpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-type; bh=R6TG+ypqAQKjbZcnxwmosuwQzjvvZ9ny8TAHSM7zwTI=; b=Da9YO9KXlGzjlanIPV5sgCHXpVV5hbULwnXG3UC9girizAZ1A1LmPKSBgKlzF7hYgL Ioz81gUJSCTN+LRZ3UwXH2aujtrYm5F0T42dTg5avt2sK72+ZVXHOdFHH5sqIlyysWtj qLCiF99Uc2mdPmzhNrL/kPio3LG4BoS2DvRGugSFvjJMcqp/iLNJ2WkU5HhY6m0zvByA y3VPsawvwcX1zisQ5+m/a8VTVgiVM/jmcnW0ryfgZZS8Kxl1hKzL4q7m7Y7+kffRwVQY Rra5Jdz65mLaJTgEIOB9t6vC3G18y4AgHPexRRNVVUTFTMXlNb54Cnx2gAX2YGkn1BSy YSQA== X-Gm-Message-State: AG10YOTfe6xYbFEl7zwqht8T96tiuK6wBZP3j8UhNmPrd3DEW5mYM1854mqhNyGsxvxTHQ== X-Received: by 10.194.158.135 with SMTP id wu7mr28026158wjb.142.1453884696108; Wed, 27 Jan 2016 00:51:36 -0800 (PST) Original-Received: from [10.0.0.1] (41-132-216-144.dsl.mweb.co.za. [41.132.216.144]) by smtp.gmail.com with ESMTPSA id lc3sm5103774wjb.7.2016.01.27.00.51.33 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 27 Jan 2016 00:51:34 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::231 X-Mailman-Approved-At: Wed, 27 Jan 2016 07:37:57 -0500 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:18137 Archived-At: This is a multi-part message in MIME format. --------------090609080201020803030007 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi Stefan, This is definitely something that's of interest to me. Closures are one of the great strengths of scheme, and have been very useful to me in the past. I'd love it for guile to have an "official" way to work with them, including your load/save semantics. What's the format of the saved state? — is it human-readable or just readable by guile? In addition it would be great for guile to be able to reason about the current state: e.g. walk the call stack and examine what's in it, or even change it. (Perhaps this is already possible, I haven't checked.) -- Andrew On 27/01/2016 10:13, Stefan Israelsson Tampe wrote: > 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 --------------090609080201020803030007 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Stefan,

This is definitely something that's of interest to me.  Closures are one of the great strengths of scheme, and have been very useful to me in the past.

I'd love it for guile to have an "official" way to work with them, including your load/save semantics.  What's the format of the saved state? — is it human-readable or just readable by guile?

In addition it would be great for guile to be able to reason about the current state: e.g. walk the call stack and examine what's in it, or even change it.  (Perhaps this is already possible, I haven't checked.)

--
Andrew

On 27/01/2016 10:13, Stefan Israelsson Tampe wrote:
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        ) <key>       associate current state to key
(.refp        ) <key>       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

--------------090609080201020803030007--