guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Errors using Guile 2.0 vs. Guile 1.8


From: Paul Smith
Subject: Re: Errors using Guile 2.0 vs. Guile 1.8
Date: Sun, 29 Jan 2012 16:51:53 -0500

On Sun, 2012-01-29 at 22:18 +0100, Thien-Thi Nguyen wrote:
> () Paul Smith <address@hidden>
> () Sun, 29 Jan 2012 10:54:18 -0500
> 
>            $ cat g1.mk
>            define show
>            (define (show s)
>              (display s)
>              (newline))
>            endef
>            $(info define display)
>            $(guile $(show))
>            $(info after define)
>            $(guile (show "HI"))      # this one
>            all:;
> 
>    I don't know what this means, or how to proceed with debugging.
> 
> What happens if you change the marked line to:
> 
>            $(guile (map object->string
>                         (list show
>                               current-output-port
>                               (current-output-port))))
> 
> ?  I would also try simply ‘$(guile show)’, but remember faintly
> that such a type would cause an error.  Thinking along these lines
> some more, the problem is perhaps with the return value of ‘show’,
> which is the return value of calling ‘newline’, which is probably
> unspecified.
> 
> As for 1.8 vs 2.0, i dare not speculate.

Sorry for being unclear.  What I was trying to indicate by having the
$(info ...) lines there is that the error is actually generated when the
(define ...) is parsed, NOT when the function is invoked.  In fact I can
remove the invocation and still get the errors:

        $ cat /tmp/g2.mk
        define show
        (define (show s)
          (display s)
          (newline))
        endef
        $(info define display)
        $(guile $(show))
        $(info after define)
        all:;
        
        $ ./make -f /tmp/g2.mk
        define display
        Backtrace:
        In ice-9/boot-9.scm:
         162: 5 [catch #t #<catch-closure 19a45c0> ...]
         170: 4 [#<procedure 19a7cd0 ()>]
        In unknown file:
           ?: 3 [catch-closure]
        In ice-9/eval.scm:
         389: 2 [eval # #]
         374: 1 [eval # #]
        In unknown file:
           ?: 0 [scm-error misc-error #f ...]
        
        ERROR: In procedure scm-error:
        ERROR: Unknown object: #<variable 19bf180 value: #<procedure 19a85a0 at 
ice-9/eval.scm:378:13 (a)>>
        after define
        make: `all' is up to date.

I can also (define ...) a function which is entirely numeric (for
example the Fibonacci calculator in the test suite) so there's no issue
with string return values or ports or anything like that:

        $ cat /tmp/g3.mk
        # Define the "fib" function in Guile
        define fib
        ;; A procedure for counting the n:th Fibonacci number
        ;; See SICP, p. 37
        (define (fib n)
          (cond ((= n 0) 0)
                ((= n 1) 1)
                (else (+ (fib (- n 1))
                         (fib (- n 2))))))
        endef
        $(guile $(fib))
        x:;
        
        $ ./make -f /tmp/g3.mk
        Backtrace:
        In ice-9/boot-9.scm:
         162: 5 [catch #t #<catch-closure add5c0> ...]
         170: 4 [#<procedure ae0cd0 ()>]
        In unknown file:
           ?: 3 [catch-closure]
        In ice-9/eval.scm:
         389: 2 [eval # #]
         374: 1 [eval # #]
        In unknown file:
           ?: 0 [scm-error misc-error #f ...]
        
        ERROR: In procedure scm-error:
        ERROR: Unknown object: #<variable afed00 value: #<procedure ae5630 at 
ice-9/eval.scm:378:13 (a)>>
        make: `x' is up to date.

As you can see I'm not actually calling these functions at all; simply
defining them is enough to cause the error.

Again these all work perfectly with Guile 1.8.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]