From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 8PJfEn8AhGOfTwAAbAwnHQ (envelope-from ) for ; Mon, 28 Nov 2022 01:27:43 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sMdhEn8AhGMOwAAA9RJhRA (envelope-from ) for ; Mon, 28 Nov 2022 01:27:43 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id EB1F63BBFC for ; Mon, 28 Nov 2022 01:27:42 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ozRzM-0007q3-AA; Sun, 27 Nov 2022 19:27:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ozRzJ-0007pa-OW for guix-devel@gnu.org; Sun, 27 Nov 2022 19:27:09 -0500 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ozRzH-0003rJ-Fm; Sun, 27 Nov 2022 19:27:09 -0500 Received: by mail-qv1-xf2f.google.com with SMTP id d2so1464124qvp.12; Sun, 27 Nov 2022 16:27:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=Rgj5wu3w2NMWDdFP+kVSBKIJSDUx2xJ7oM5O/iwVfws=; b=MujcTQWfYopqaSgw6MS8AMUscsqXwcbnxOO2AAX9XfQG50xSs4Efkr7YTK5yBhzZWa +GaTb0X8f1EvBfEB3tBf6DiwXjfAzyOuriBKpSVkjXuM8ClzLXH9QxY+U7UI1S8lnzNE Ai0W44JJAhQC0uhQvoT2zMiaxNCSfo2tokWAioc1EpidEziLzcqoY40wPnBPKVWER/Qq eVFnW/ySRLuM0bhYIPIJnUBjaU2LqWXHFRUVjYRSXrN4m8qpISm45TCqkGN1bFniUI+j zJvV4sEEmr70AJyJUqv2BbKGMOAT12JiKaRVDDqFd/cHXmr/xnZnn0DPgLuYt2sau331 WR5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Rgj5wu3w2NMWDdFP+kVSBKIJSDUx2xJ7oM5O/iwVfws=; b=fJKgtvgngicO5tnM0AZSZZfezflanlDPZsFy3zUDoxp7+q64u2uKrSzO+HH5/aVTMl mKwqjY66xhJZLvLjKZcr/8VTVJJlEy+oAhTxHENCj/Y7HZyfX0ZYd3SZq3+Hex5hmQXF gtukpqFKHFmjYtag6duyrCQJVC418jzagdNK0DetW6eD2QS2fBSKfSiMgtQ2KNawpdR5 VxO0k+a8sdoq1I9R03/jh8+zD6Mrux+BGtxq5MOpSHxsGzuZVMosGXhzDe5HBNI+yuT9 1VJ76RZopSQqNRccFVpzIglSadZJU1QFbWJMMzKhsyJLd89v+pj5hCXtNX7A5CNKL1L9 udIg== X-Gm-Message-State: ANoB5pnbmRM/PT9TDbI6r6e5UUdXjuQSjmO+2F128ds5oDvTmLmRiq8T e73Sfyo1WLmCywSMHAKPNy1vMwDmEuM= X-Google-Smtp-Source: AA0mqf7jBRaAAaX4mo2lLXfWA5q9AJJjno9WKs+DHPqA6PT4Oaiw93HlwU4aGP3hfTzS1oVKA2d10Q== X-Received: by 2002:a05:6214:590e:b0:4c6:aaeb:6384 with SMTP id lp14-20020a056214590e00b004c6aaeb6384mr26800802qvb.41.1669595225255; Sun, 27 Nov 2022 16:27:05 -0800 (PST) Received: from hurd (dsl-151-252.b2b2c.ca. [66.158.151.252]) by smtp.gmail.com with ESMTPSA id f6-20020a05620a280600b006eef13ef4c8sm7384159qkp.94.2022.11.27.16.27.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 16:27:04 -0800 (PST) From: Maxim Cournoyer To: zimoun Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , guix-devel Subject: Re: Guile debugger workgroup? References: <86o7ss1u49.fsf@gmail.com> Date: Sun, 27 Nov 2022 19:27:04 -0500 In-Reply-To: <86o7ss1u49.fsf@gmail.com> (zimoun's message of "Sun, 27 Nov 2022 13:04:22 +0100") Message-ID: <87h6yjvs87.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::f2f; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qv1-xf2f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1669595263; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Rgj5wu3w2NMWDdFP+kVSBKIJSDUx2xJ7oM5O/iwVfws=; b=FTBDXzmxx3ALLnSXqIirhTxTk9mI9zKKWlIiOscgIi3earDHVL0CPny7hMHihEGYOFbM4R Ut02ZXjPlrUsFidAhM07flpHOKN9DD4Gpdya6e0gdePLDB0YZBWs+zvik9TEax/v+n/swu nre7hZpw3d9kOzfwSQNXwTtLxKiOP3fj+6iFSNm2SDcAxllAdgqpJ4gzJt6bMMhpe2Nwgd Z1Ztd90V2c+QYAfyrFohGKRMQ8lRXvn2dJLU9MnX1p0Yo5HWQMODLjiFAdua8YGvYP8r+Q uRX/NahCJq7fAPneUMb4xpL1vfC2YKP0gxZGCOefCcWB0C4wxaD+e5JC0cxonA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1669595263; a=rsa-sha256; cv=none; b=Uuv8HQxU4MHI5LhcmOhIdfv+/GAlV6KvGa2ZITcft1vOXh3n5KFzXi6h7m0yO2Z7vu69FJ ZxqrhubqeJJ3zWVFPCHjDa9/G24uJvVkyYV8AD3DHWsn/sBLLnLfHCBbMX/ua4Wnv9GEdE mBFWKrYRCiSkrgkvqSdijA9jE1hCWSjCIhqMIfRzlaQHPfrD5px3rs/AXsupGQbCzWrCGu yN7T4/ZjxEZZrS0/L3UtP4HVuTVmnd5ks4NFiZX+ixi/qzbFF7ZO2jVkZVwZDX1DdmwXUo HCBhn3P/SyAb688esbi7kX9u3TAls2911BuTkvw6F5colwGAS5ihsWclXZowCw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=MujcTQWf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.96 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=MujcTQWf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: EB1F63BBFC X-Spam-Score: -2.96 X-Migadu-Scanner: scn1.migadu.com X-TUID: /zV1V6lYxrcg Hi Simon, zimoun writes: [...] > Racket is an example of functional programming and live coding. Haskell > is another; it is functional programming and if I might, I would > recommend to give a look at the interactive GHCi debugger [1]. > > Back to the initial example [2]. Racket is able to set breakpoints at > various places, as shown in the short demo [3]. Well, I am not able to > do that with Guile. > > $ cat -n my-target.scm > 1 ;#lang racket > 2=09 > 3 (define (mutate-once x) > 4 (let ((once "once") > 5 (dash "-")) > 6 (string-append x dash once))) > 7=09 > 8 (define (mutate-twice x) > 9 (let* ((dash "-") > 10 (twice "twice") > 11 (stuff (string-append twice dash))) > 12 (string-append "twice-" x))) > 13=09 > 14 (define (do-something-with x) > 15 (string-length x)) > 16=09 > 17 (define (example x) > 18 (let* ((my-target "something") > 19 (my-target (mutate-once my-target)) > 20 (my-target (mutate-twice my-target))) > 21 (do-something-with my-target))) > > > then, > > $ guix repl > GNU Guile 3.0.8 > Copyright (C) 1995-2021 Free Software Foundation, Inc. > > Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. > This program is free software, and you are welcome to redistribute it > under certain conditions; type `,show c' for details. > > Enter `,help' for help. > scheme@(guix-user)> (load "my-target.scm") > scheme@(guix-user)> ,break-at-source "my-target.scm" 17 > While executing meta-command: > No procedures found at ~a:~a. "my-target.scm" 17 > scheme@(guix-user)> ,break-at-source "/home/simon/tmp/my-target.scm" 17 > While executing meta-command: > No procedures found at ~a:~a. "/home/simon/tmp/my-target.scm" 17 > scheme@(guix-user)> (example #t) > $1 =3D 20 > scheme@(guix-user)> ,break example > Trap 2: Breakpoint at #. > scheme@(guix-user)> (example #t) > $2 =3D 20 > scheme@(guix-user)> > > > How can I enter in the debugger? Do I only enter on error? Well, I end > to put =E2=80=99pk=E2=80=99 here and there to inspect the code. Poor exp= erience. :-) > > Just to compare with Haskell (functional style, where it is hard nor > impossible to put equivalent of =E2=80=99pk=E2=80=99 here or there :-)) = =E2=80=93 the code is > the equivalent as above. > > 1 mutate_once x =3D x ++ dash ++ once > 2 where > 3 once =3D "once" > 4 dash =3D "-" > 5=09 > 6 mutate_twice x =3D stuff ++ x > 7 where > 8 dash =3D "-" > 9 twice =3D "once" > 10 stuff =3D twice ++ dash > 11=09 > 12 do_something_with x =3D length x > 13=09 > 14 example x =3D do_something_with my_target > 15 where > 16 my_target =3D mutate_twice my_target > 17 where > 18 my_target =3D mutate_once my_target > 19 where > 20 my_target =3D "something" > > > then, > > $ guix shell ghc gcc-toolchain -- ghci > GHCi, version 8.10.7: https://www.haskell.org/ghc/ :? for help > Prelude> :load my-target.hs > [1 of 1] Compiling Main ( my-target.hs, interpreted ) > Ok, one module loaded. > *Main> :break 14 > Breakpoint 0 activated at my-target.hs:14:13-39 > *Main> example True > Stopped in Main.example, my-target.hs:14:13-39 > _result :: Int =3D _ > my_target :: [Char] =3D _ > [my-target.hs:14:13-39] *Main> :list > 13=20=20 > 14 example x =3D do_something_with my_target > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ > 15 where > [my-target.hs:14:13-39] *Main> :break 18 > Breakpoint 1 activated at my-target.hs:18:21-41 > [my-target.hs:14:13-39] *Main> :continue > Stopped in Main.example.my_target.my_target, my-target.hs:18:21-41 > _result :: [Char] =3D _ > my_target :: [Char] =3D _ > [my-target.hs:18:21-41] *Main> :list > 17 where > 18 my_target =3D mutate_once my_target > ^^^^^^^^^^^^^^^^^^^^^ > 19 where > [my-target.hs:18:21-41] *Main> my_target > "something" > [my-target.hs:18:21-41] *Main> > > > Well, again maybe I miss how to use the Guile debugger. From my small > experience, I have hard time to debug and inspect Guile code. I think your above example summarizes well what appears to be wrong with the Guile debugging experience; at least I personally strongly relate. We should turn this kind of scenario into unit tests for Guile; the output of the workgroup could then be to make these pass! There are also paper cuts such as the malformed error message "No procedures found at ~a:~a. "my-target.scm" 17". When searching for how the debugger work in the Guile Reference info manual, I also don't find anything useful: only the gut of the debugging API of the Guile VM appears to be documented ("Debugging Infrastructure"), so documentation is another place that could be improved, with some examples and pro tips for real life, practical debugging with Guile. --=20 Thanks, Maxim