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 Subject: Re: persistant state in guile-log Date: Wed, 27 Jan 2016 12:32:49 +0100 Message-ID: References: <56A88512.7070006@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11465bc46bdcac052a4f29f8 X-Trace: ger.gmane.org 1453894377 7065 80.91.229.3 (27 Jan 2016 11:32:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 27 Jan 2016 11:32:57 +0000 (UTC) Cc: guile-devel To: Andrew Gaylard Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jan 27 12:32:57 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 1aOOLH-0002Fk-Rd for guile-devel@m.gmane.org; Wed, 27 Jan 2016 12:32:56 +0100 Original-Received: from localhost ([::1]:49645 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOOLH-00081y-6B for guile-devel@m.gmane.org; Wed, 27 Jan 2016 06:32:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOOLD-00081s-5l for guile-devel@gnu.org; Wed, 27 Jan 2016 06:32:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOOLB-0002sI-PE for guile-devel@gnu.org; Wed, 27 Jan 2016 06:32:51 -0500 Original-Received: from mail-qg0-x22d.google.com ([2607:f8b0:400d:c04::22d]:33617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOOLB-0002s9-K1 for guile-devel@gnu.org; Wed, 27 Jan 2016 06:32:49 -0500 Original-Received: by mail-qg0-x22d.google.com with SMTP id b35so3863317qge.0 for ; Wed, 27 Jan 2016 03:32:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=c2neQjXf6MYw6XJksPBpMyaMhMa+lkglgChovniMuY4=; b=EiMEkp4AvrfHL3ACWXt5YA48WoAb18FJOQwnAs0DWulnkHL3jyRzYLNwF5aqHAxxGT RinP8VFP7p8d21p0abmgvwDIF+8RXAGIiI2GmZ5Wjqa6nHrDTjjfd/dy6DRVLH/FV3Y6 z0XVa75tp3h/kAecySrUql3GGJEq6mAXsPVcxwUr/ZQWlzjHjqAD5aIpngdJMYLWci9f seO9c/31kWjwdLxh+KvIrz0a5W23G4QAyyd7Eke3DFAPfLBvfthrihMsF9hcn1ClpyWB AVNmp5Ktm1+/RCJh2ZZHoi/Wy/W1TEs4iBdnn2k7VZhPFdAxoRvGKn49YXDXcJvzlCBO BYRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=c2neQjXf6MYw6XJksPBpMyaMhMa+lkglgChovniMuY4=; b=OcGtHZxxVNfLJczvlm9Najln7PV+uTPA7zbtyS0Msl4UgCgOBlXQknzgT8A72YhY54 i6jhhdqYitj2oiOSKNIyNLUSgR0UyEnWBr3CG1KHZfjpSplrLkERmGxG21ohHOFSfT75 fVuCK2fnRVB8RZryl+9jCOEddeVEGTiwMjFkVB0RjVj0pnlsaxPTwu8RI1pg8ewhd0/l mx0jiDwErcE34Lq9EtcwFvpvocL3wxq5c9K46L3ij2pVpmMLogEE0MeTGK41XCUGJUhS 7PjxeNht/xbl9odDp9JhccMfpUe+5tDT4W0lyzY4qu+6HWU8FNmEbUdo9DzyITmKmWP+ hgLQ== X-Gm-Message-State: AG10YOS8C84Gmj4+2BQ5jjbtZiogUugGwAsvPhcoPWyXvGd/53a4oqowWXzwyxfjfoebGX+R2SaeqDeakkSy5Q== X-Received: by 10.140.145.72 with SMTP id 69mr2890054qhr.95.1453894369269; Wed, 27 Jan 2016 03:32:49 -0800 (PST) Original-Received: by 10.55.174.70 with HTTP; Wed, 27 Jan 2016 03:32:49 -0800 (PST) In-Reply-To: <56A88512.7070006@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c04::22d 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:18136 Archived-At: --001a11465bc46bdcac052a4f29f8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable >> This is definitely something that's of interest to me. fine, then I know that it can be a useful library. But there need to be a discussion about an official interface or method to persist them and I hope that guile maintainers will chime in on this and enlight us. > is it human-readable or just readable by guile? My format is readable and read in to guile via read > 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.) i don't know about modifying the stack, but inspect ut is quite possible. Regards Stefan On Wed, Jan 27, 2016 at 9:51 AM, Andrew Gaylard wrote= : > 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= ? > =E2=80=94 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 mean= s > 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=3D1,stall,Y=3D2. > prolog> .setp 1 > prolog> .savep > prolog> .quit > > stis> guile-prolog > prolog> .loadp > prolog> .refp 1 > prolog> .cont > > X=3D1 > Y=3D2 > > 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 o= f > 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 > > > --001a11465bc46bdcac052a4f29f8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
>> This is definite= ly something that's of interest to me.
fine, then I know= that it can be a useful library. But there need to be a discussion about a= n official interface or method
to persist them and I hope that gu= ile maintainers will chime in on this and enlight us.

<= div>> is it human-readable or just read= able by guile?
My for= mat is readable and read in to guile via read

> In addition it would be great for guile to be able to reason about t= he current state: e.g. walk the call stack and examine what's in it, or= even change it.=C2=A0 (Perhaps this is already possible, I=C2=A0
> haven't checked.)<= span style=3D"font-size:12.8px">
i don't know about modifying the stack, but inspect ut is q= uite possible.

Regards
Stefan

On Wed, Jan 27, 2016 at 9:51 AM, Andrew= Gaylard <a.gaylard@gmail.com> wrote:
=20 =20 =20
Hi Stefan,

This is definitely something that's of interest to me.=C2=A0 Closur= es 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 w= ith them, including your load/save semantics.=C2=A0 What's the format of the = saved state? =E2=80=94 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.=C2=A0 (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> =C2=A0X=3D1,stall,Y=3D= 2.
prolog> .setp 1
prolog> .savep
prolog> .quit

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

=C2=A0 X=3D1
=C2=A0 Y=3D2

prolog>
This is the interface:
------------------------------------= ---------------------------------
(.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> =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 care. What's more d= emading 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


--001a11465bc46bdcac052a4f29f8--