[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#24887: procedure-sources not working
From: |
Jean Louis |
Subject: |
bug#24887: procedure-sources not working |
Date: |
Wed, 1 Mar 2017 17:43:36 +0300 |
On Wed, Mar 01, 2017 at 03:09:06PM +0100, Andy Wingo wrote:
> On Sat 05 Nov 2016 23:01, Jean Louis <address@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