From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: REPL history Date: Tue, 07 Mar 2017 10:23:02 +0100 Message-ID: <87wpc18mq1.fsf@pobox.com> References: <20170305170631.GA4916@localhost.localdomain> <20170305175713.GA19769@tuxteam.de> <20170306191502.GA27659@localhost.localdomain> <87d1du9ln0.fsf@pobox.com> <20170306214429.GB27659@localhost.localdomain> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488878620 3657 195.159.176.226 (7 Mar 2017 09:23:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 7 Mar 2017 09:23:40 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Mar 07 10:23:35 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 1clBL9-0000Bd-H5 for guile-user@m.gmane.org; Tue, 07 Mar 2017 10:23:31 +0100 Original-Received: from localhost ([::1]:48383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clBLF-0005pM-O4 for guile-user@m.gmane.org; Tue, 07 Mar 2017 04:23:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clBKu-0005pC-JD for guile-user@gnu.org; Tue, 07 Mar 2017 04:23:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clBKr-0007ry-Dj for guile-user@gnu.org; Tue, 07 Mar 2017 04:23:16 -0500 Original-Received: from pb-sasl2.pobox.com ([64.147.108.67]:61872 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clBKr-0007rj-9p for guile-user@gnu.org; Tue, 07 Mar 2017 04:23:13 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id AE3AD78803 for ; Tue, 7 Mar 2017 04:23:12 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=fZoPKygzsqDniE/Xsko1ZN7IknY=; b=hhXKxf 59S8bcXFuIILMpPkKhYRzwMsgzc7iARlMwt5ndDKZbWv351cyRNbpEkIyjkFBCIh zX0Ol4yAGD8fn4jp0Z+GhJF1poAJ39U1zmeBWRmrG/dB/Yj2Pce2I+4Q9h2pKc3H UFsXyMbA0n3tx4xOM3u9ma1rL5s5VMaqUKxLE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:subject :references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=DLtCnWc+XhQI9ssNJJ95tDfcrQVxfG/r AafUYN3K4GRKXKKUITBffiD4vhN2bMU0jcc83601zcD2ZCTtN8pkJvxyFn9r9287 2iii9j+GJGvrjPyfAS4OHS9yqymEy1jFRS4lWA5oPM5vYntMu+YBWOwm8AxcoAw0 ZOPxfVmsrHM= Original-Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id A3EE278801 for ; Tue, 7 Mar 2017 04:23:12 -0500 (EST) Original-Received: from clucks (unknown [109.190.228.233]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl2.pobox.com (Postfix) with ESMTPSA id B8B2D78800 for ; Tue, 7 Mar 2017 04:23:11 -0500 (EST) In-Reply-To: <20170306214429.GB27659@localhost.localdomain> (Vladimir Zhbanov's message of "Tue, 7 Mar 2017 00:44:29 +0300") X-Pobox-Relay-ID: AF62A464-0317-11E7-90B7-85AB91A0D1B0-02397024!pb-sasl2.pobox.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.108.67 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:13436 Archived-At: 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! Andy