From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Vladimir Zhbanov Newsgroups: gmane.lisp.guile.user Subject: Re: REPL history Date: Tue, 7 Mar 2017 17:44:45 +0300 Message-ID: <20170307144445.GA14910@localhost.localdomain> References: <20170305170631.GA4916@localhost.localdomain> <20170305175713.GA19769@tuxteam.de> <20170306191502.GA27659@localhost.localdomain> <87d1du9ln0.fsf@pobox.com> <20170306214429.GB27659@localhost.localdomain> <87wpc18mq1.fsf@pobox.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Trace: blaine.gmane.org 1488897927 1771 195.159.176.226 (7 Mar 2017 14:45:27 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Mar 2017 14:45:27 +0000 (UTC) User-Agent: Mutt/1.5.23 (2014-03-12) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Mar 07 15:45:16 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1clGMW-0007vr-CP for guile-user@m.gmane.org; Tue, 07 Mar 2017 15:45:16 +0100 Original-Received: from localhost ([::1]:50970 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clGMc-0002e8-Kl for guile-user@m.gmane.org; Tue, 07 Mar 2017 09:45:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clGM8-0002dA-QF for guile-user@gnu.org; Tue, 07 Mar 2017 09:44:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clGM4-0000bY-TP for guile-user@gnu.org; Tue, 07 Mar 2017 09:44:52 -0500 Original-Received: from mail-lf0-x22c.google.com ([2a00:1450:4010:c07::22c]:33854) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1clGM4-0000ap-Lq for guile-user@gnu.org; Tue, 07 Mar 2017 09:44:48 -0500 Original-Received: by mail-lf0-x22c.google.com with SMTP id k202so1830965lfe.1 for ; Tue, 07 Mar 2017 06:44:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/59hr+kemaAnt50wTY4Ei7FAgBXQMJuhRZ9F5uE5i6Q=; b=B8QH+Lzp4YTNlcb9BAWvZXcwugPvxIT5mMThb90WTbD3WZbFgDBj21SpPLTYwrnW9z jNhO3+BLua8NkJt9CUcfswKna7FRPC0TKrbN8KTSBOzkrSO0Ft6g5sa1H991fxV26/dd //gs7gOTtrE1Iakz+zr7X8Jti3vVTO+0pThib5VPa2MA7RcnFkewqw+V3kZ2xWRheE4o Nk0aTQePOcoji7dgqLNda8n1laj8XGd/7EGz8yI7XCzc96HZSF9IjqznJFrb+UKitHqB cXYmwawH/QtnY62o73mS3E7DSITmDlTTkjA6GstFpmK3ho+srHAD1CzH7InFEpSjHpXf keoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=/59hr+kemaAnt50wTY4Ei7FAgBXQMJuhRZ9F5uE5i6Q=; b=sQ0ZP1NTGd/SiBjdzWjG8byqEopXik8izlG6PAIibirM1gUC4S8DXlBvpvEhg7CI/0 bj0670wcDXQs8RbAcxpJQ7cRdoVKRdA6IRJvxRHe+RDBawDWXV6WsNmk0zMqahJ6xmHk QzDompQ2nS22Yqs8PQ9+FNvqVxL8RkONQJxFnReZ4hC/St2IEW1tNqTf1/2b0xN7SITe PAFN8amTV/VD+muqenL434jPdbOODQYz7rnQwFJyaLUMuElxt6xvZ0SaQhOncNt8AsMg TALZIbmd3ggYhpEeab+EQ6818710CBwh8APzQPCMy6QUTpf9z/Y0H41o4wMbB7j62+O3 cMLw== X-Gm-Message-State: AMke39lEJUFq9BSovIwNuG7jPbppJtO8E5gyTLe/D3S80mEbHOXUBjKNnyElMoNDuEZsuA== X-Received: by 10.25.201.74 with SMTP id z71mr197728lff.108.1488897886876; Tue, 07 Mar 2017 06:44:46 -0800 (PST) Original-Received: from newvzh.vzh ([213.24.126.192]) by smtp.gmail.com with ESMTPSA id s70sm36009lfe.32.2017.03.07.06.44.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Mar 2017 06:44:46 -0800 (PST) Original-Received: from vovka by newvzh.vzh with local (Exim 4.84_2) (envelope-from ) id 1clGM1-0002gb-Gd for guile-user@gnu.org; Tue, 07 Mar 2017 17:44:45 +0300 Mail-Followup-To: guile-user@gnu.org Content-Disposition: inline In-Reply-To: <87wpc18mq1.fsf@pobox.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::22c X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.lisp.guile.user:13442 Archived-At: On Tue, Mar 07, 2017 at 10:23:02AM +0100, Andy Wingo wrote: > On Mon 06 Mar 2017 22:44, Vladimir Zhbanov writes: > > > What I tried so far is to manually save dynamic state in repl: > > (define ds (current-dynamic-state)) > > > > and use it in GUI (with support of guile expression evaluation): > > (with-dynamic-state ds (lambda () (write-history history-filename))) > > > > This is for readline history saving, and works pretty well. > > > > So I was thinking to bake something like this into the above code, > > probably by adding a variable on the repl-eval stage to store > > initial dynamic state in repl. The problem occured when I started > > to call (quit) or (throw 'quit) the same way, that is, in the > > thunk called in with-dynamic-state. It just segfaulted. > > > > And my app is tied to 2.0 these days. > > There is a bug in 2.0 (and actually in 2.2 as well; closer to being > fixed but not fixed entirely) about moving dynamic states between > threads. Basically the dynamic state also captures exception handlers, > but attempting to handle the exceptions tries to abort to prompts that > aren't live, leading to sadness. This NEWS entry discusses part of the > problem: > > ** Fix too-broad capture of dynamic stack by delimited continuations > > Guile was using explicit stacks to represent, for example, the chain of > current exception handlers. This means that a delimited continuation > that captured a "catch" expression would capture the whole stack of > exception handlers, not just the exception handler added by the "catch". > This led to strangeness when resuming the continuation in some other > context like other threads; "throw" could see an invalid stack of > exception handlers. This has been fixed by the addition of the new > "fluid-ref*" procedure that can access older values of fluids; in this > way the exception handler stack is now implicit. See "Fluids and > Dynamic States" in the manual, for more on fluid-ref*. > > I don't know if we will be able to fix this in 2.0 or not :/ I'm very > sorry that you have run into all these problems though! Thank you for the explanation! -- Vladimir