GNU bug report logs - #24887
procedure-sources not working

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guile; Reported by: Jean Louis <bugs@HIDDEN>; dated Sat, 5 Nov 2016 22:03:01 UTC; Maintainer for guile is bug-guile@HIDDEN.

Message received at 24887 <at> debbugs.gnu.org:


Received: (at 24887) by debbugs.gnu.org; 1 Mar 2017 14:46:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 01 09:46:53 2017
Received: from localhost ([127.0.0.1]:33051 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cj5Wn-00012T-3D
	for submit <at> debbugs.gnu.org; Wed, 01 Mar 2017 09:46:53 -0500
Received: from stw1.rcdrun.com ([217.170.207.13]:42498)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bugs@HIDDEN>) id 1cj5Wl-00012H-NM
 for 24887 <at> debbugs.gnu.org; Wed, 01 Mar 2017 09:46:52 -0500
Received: from protected.rcdrun.com (localhost [::1])
 (AUTH: PLAIN securesender, TLS: TLSv1/SSLv3,256bits,AES256-SHA)
 by stw1.rcdrun.com with ESMTPSA; Wed, 01 Mar 2017 07:47:13 -0700
 id 00000000000866AD.0000000058B6DEF2.0000432C
Received: from localhost (localhost [127.0.0.1]) (uid 1001)
 by protected.rcdrun.com with local; Wed, 01 Mar 2017 17:43:36 +0300
 id 00000000000ED1AC.0000000058B6DE18.00003E9B
Date: Wed, 1 Mar 2017 17:43:36 +0300
From: Jean Louis <bugs@HIDDEN>
To: Andy Wingo <wingo@HIDDEN>
Subject: Re: bug#24887: procedure-sources not working
Message-ID: <20170301144335.GF11339@HIDDEN>
References: <20161105220110.GA3991@HIDDEN>
 <878topgkcd.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <878topgkcd.fsf@HIDDEN>
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 24887
Cc: guile-devel@HIDDEN, 24887 <at> debbugs.gnu.org, Jean Louis <bugs@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

On Wed, Mar 01, 2017 at 03:09:06PM +0100, Andy Wingo wrote:
> On Sat 05 Nov 2016 23:01, Jean Louis <bugs@HIDDEN> writes:
> 
> > Sadly, the procedure-source is not working. This would be very useful
> > for programming.
> >
> > Jean
> >
> > scheme@(guile-user) [50]> (define (dosomething text) (write text))
> > scheme@(guile-user) [50]> (dosomething "Hello")
> > "Hello"scheme@(guile-user) [50]> (procedure-source dosomething )
> > $93 = #f
> > scheme@(guile-user) [50]> 
> 
> Sadly I think I am going to WONTFIX this one :/
> 
> The reason is complicated.  First of all, a procedure's source only
> makes sense within an environment: in a module and in a lexical
> context, and you're not guaranteed to be able to reconstruct either of
> those.  Also a procedure's source is expressed in some dialect via
> macros; what should the source be for even this simple example?  Should
> it be:

Thank you. I am not an advanced user of Guile. And that
procedure-source, I can compare to (SYMBOL-PLIST 'FUNCTION) in Lisp,
as I am also using CLISP.

If I have a function defined, such as RED, then I can see the source
of the function in CLISP:

(symbol-plist 'red)
(SYSTEM::DEFINITION ((DEFUN RED (FILE) (ED FILE) (LOAD FILE)) . #(NIL NIL NIL NIL ((DECLARATION OPTIMIZE DECLARATION)))) SYSTEM::DOC
 (SYSTEM::FILE ((SYSTEM::DEFUN/DEFMACRO
 #P"/home/data1/protected/.clisprc.lisp" 53 53))))

And I was simply expecting the PROCEDURE-SOURCE in Guile to behave in
similar fashion.

From documentation:

-- Scheme Procedure: procedure-source proc
 -- C Function: scm_procedure_source (proc)
     Return the source of the procedure PROC.  Returns ‘#f’ if the
     source code is not available.

So that is what I am expecting according to documentation. As I am not
developer of Guile, rather user and student, I cannot go into details,
if it should be there or not.

It is simply there and is not functioning, so it is expected to
function. Or you propose the removal, I don't mind.

Jean Louis




Information forwarded to bug-guile@HIDDEN:
bug#24887; Package guile. Full text available.

Message received at 24887 <at> debbugs.gnu.org:


Received: (at 24887) by debbugs.gnu.org; 1 Mar 2017 14:09:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 01 09:09:18 2017
Received: from localhost ([127.0.0.1]:33010 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cj4wP-000062-QT
	for submit <at> debbugs.gnu.org; Wed, 01 Mar 2017 09:09:18 -0500
Received: from pb-sasl2.pobox.com ([64.147.108.67]:61226
 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <wingo@HIDDEN>) id 1cj4wO-00005u-NR
 for 24887 <at> debbugs.gnu.org; Wed, 01 Mar 2017 09:09:17 -0500
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1])
 by pb-sasl2.pobox.com (Postfix) with ESMTP id 5BDE9659AA;
 Wed,  1 Mar 2017 09:09:14 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=sasl; bh=MImGCrtADyHeqxLQAPU2mFSwwiY=; b=QIwsOY
 MS55Dx6YLHaCUPQ5nXhvRBGRCDDApYL/xIWG1bPJSh9Q0a7vL+H/xnnitC2epgPM
 1Pe9rg7zuzUOYoJR7e517rtD7epbmyeCi7QQ5acD8NZho/5dXuqd9oNCxDt8/7DE
 72M/Fz12UrgYTNNQdaZB/OkwnXUehki228lpQ=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; q=dns; s=sasl; b=NA27UmRsM+2wgoXmfrH8wm4YeRnl0/4V
 kan/qrybOkLdTRd7RT3XIS0pDKaTJPzI/IrXC0BgbaQxjo5/o2UkcgQh4fZ/UMLV
 HcnlqJ+LCttT1xXkeipmWK87p4hby1Mq6nbAc0WCg41mpHDEpe+k4FXRY1VT6i7p
 nCRTaGxud+M=
Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1])
 by pb-sasl2.pobox.com (Postfix) with ESMTP id 53893659A9;
 Wed,  1 Mar 2017 09:09:14 -0500 (EST)
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 42521659A8;
 Wed,  1 Mar 2017 09:09:13 -0500 (EST)
From: Andy Wingo <wingo@HIDDEN>
To: Jean Louis <bugs@HIDDEN>
Subject: Re: bug#24887: procedure-sources not working
References: <20161105220110.GA3991@HIDDEN>
Date: Wed, 01 Mar 2017 15:09:06 +0100
In-Reply-To: <20161105220110.GA3991@HIDDEN> (Jean Louis's
 message of "Sun, 6 Nov 2016 01:01:10 +0300")
Message-ID: <878topgkcd.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Pobox-Relay-ID: A5EF6504-FE88-11E6-8B15-85AB91A0D1B0-02397024!pb-sasl2.pobox.com
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 24887
Cc: guile-devel@HIDDEN, 24887 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

On Sat 05 Nov 2016 23:01, Jean Louis <bugs@HIDDEN> writes:

> Sadly, the procedure-source is not working. This would be very useful
> for programming.
>
> Jean
>
> scheme@(guile-user) [50]> (define (dosomething text) (write text))
> scheme@(guile-user) [50]> (dosomething "Hello")
> "Hello"scheme@(guile-user) [50]> (procedure-source dosomething )
> $93 = #f
> scheme@(guile-user) [50]> 

Sadly I think I am going to WONTFIX this one :/

The reason is complicated.  First of all, a procedure's source only
makes sense within an environment: in a module and in a lexical
context, and you're not guaranteed to be able to reconstruct either of
those.  Also a procedure's source is expressed in some dialect via
macros; what should the source be for even this simple example?  Should
it be:

  (define (dosomething text) (write text))

or

  (lambda (text) (write text))

And if we can't get it right (i.e., don't even know what the right
answer is) for even this simple case, how can we get it right for
something that uses macros or is defined by a macro?  What use is it,
really?  Better to just be able to link back to the source location at
which it was defined (we can do that) or to disassemble what it does (we
can do that too).

It's possible to imagine environments where you can edit the procedure's
source and continue directly, but that's not Guile -- we compile away
extraneous information that maybe you might would need if you edit a
procedure's source (e.g. you introduce a reference to a variable bound
in some outer scope that wasn't referenced before).

All that said, it's possible to attach arbitrary properties to source.
So consider:

  (define-syntax-rule (define-with-source (proc . args) body ...)
    (define (proc . args)
      ;; this is how you attach arbitrary literals as procedure
      ;; properties efficiently, inside source
      #((source . (lambda args body ...)))
      body ...))

  (define-with-source (my-proc a b) (list a b))

  (procedure-property my-proc 'source)
  => (lambda (a b) (list a b))

Indeed because procedure-source just looks for the 'source property on
my-proc, you can do:

  (procedure-source my-proc)
  => (lambda (a b) (list a b))

Hope this helps.  Not sure if we should bless a "define-with-source" in
Guile; thoughts?  Is it even useful at all?

Andy




Information forwarded to bug-guile@HIDDEN:
bug#24887; Package guile. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 5 Nov 2016 22:02:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 05 18:02:06 2016
Received: from localhost ([127.0.0.1]:46190 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1c392M-0002Hp-DW
	for submit <at> debbugs.gnu.org; Sat, 05 Nov 2016 18:02:06 -0400
Received: from eggs.gnu.org ([208.118.235.92]:49396)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bugs@HIDDEN>) id 1c392K-0002HK-HQ
 for submit <at> debbugs.gnu.org; Sat, 05 Nov 2016 18:02:04 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bugs@HIDDEN>) id 1c392E-0001wY-Hd
 for submit <at> debbugs.gnu.org; Sat, 05 Nov 2016 18:01:59 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:44110)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <bugs@HIDDEN>) id 1c392E-0001wL-Em
 for submit <at> debbugs.gnu.org; Sat, 05 Nov 2016 18:01:58 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:40367)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bugs@HIDDEN>) id 1c392D-0005QT-DY
 for bug-guile@HIDDEN; Sat, 05 Nov 2016 18:01:58 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bugs@HIDDEN>) id 1c392A-0001tb-Ci
 for bug-guile@HIDDEN; Sat, 05 Nov 2016 18:01:57 -0400
Received: from stw1.rcdrun.com ([217.170.207.13]:43418)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <bugs@HIDDEN>) id 1c392A-0001sR-6F
 for bug-guile@HIDDEN; Sat, 05 Nov 2016 18:01:54 -0400
Received: from protected.rcdrun.com (localhost [::1])
 (AUTH: PLAIN securesender, TLS: TLSv1/SSLv3,256bits,AES256-SHA)
 by stw1.rcdrun.com with ESMTPSA; Sat, 05 Nov 2016 15:02:17 -0700
 id 0000000000049DDE.00000000581E56EA.00006609
Received: from localhost (localhost [127.0.0.1]) (uid 1001)
 by protected.rcdrun.com with local; Sun, 06 Nov 2016 01:01:10 +0300
 id 0000000000020F5A.00000000581E56A6.00000FA8
Date: Sun, 6 Nov 2016 01:01:10 +0300
From: Jean Louis <bugs@HIDDEN>
To: bug-guile@HIDDEN
Subject: procedure-sources not working
Message-ID: <20161105220110.GA3991@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.1 (----)

Sadly, the procedure-source is not working. This would be very useful
for programming.

Jean

scheme@(guile-user) [50]> (define (dosomething text) (write text))
scheme@(guile-user) [50]> (dosomething "Hello")
"Hello"scheme@(guile-user) [50]> (procedure-source dosomething )
$93 = #f
scheme@(guile-user) [50]> 




Acknowledgement sent to Jean Louis <bugs@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guile@HIDDEN. Full text available.
Report forwarded to bug-guile@HIDDEN:
bug#24887; Package guile. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.