This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Hobittable but nonexecutable code


Bernard URBAN wrote:

> >>>>> "Alexander" == Alexander Asteroth <alexander.asteroth@informatik.uni-bonn.de> writes:
>
>     Alexander> The following simple program:
>
>     Alexander> (define-module (std io)) (define-public println
>     Alexander> println) ; because of non-hobbitability of ;
>     Alexander> (define-public (sum . args) (apply + args))
>
>     Alexander> (define (println . args) (for-each display args) ;;;;
>     Alexander> this line produces the error (newline) (force-output) )
>
>     Alexander> (display "ready\n")
>
>     Alexander> Compiles without warning but when executed produces the
>     Alexander> following error message:
>
>     >> a.out
>     Alexander> ERROR: In procedure apply: ERROR: Wrong type argument
>     Alexander> in position 1: %S
>
> Don't fotget that define-module and define-public are macros, which
> definitions are unknown to hobbit. So, put the relevant macros on
> top of your file. The simplest way to do this
> is to include file hobbit4d/module.scm from the distribution.
>
> (as the use of define-module may break in some cases, this inclusion
> is currently desactivated)
>
> Secondly, don't forget to compile with the -m flag !!!
> (this will be the default in next release)
>
> With these modifications, I can compile and run your program
> correctly, even when adding after:
> (display "ready\n")
> the line:
> (println 456 'ert "ertg")
>
> --
>
> B. Urban

It works if I don't use define-module.
But the below program still doesn't work even if the README says:

>  That is, you can, if there is a unique (define-module ...) at
>  the top of the file, just after the inclusion of the macros for
>  modules.

What does the definition of define-module at the beginning of
hobbit4d/modules.scm do?

Ciao, Alex

test.scm:

(load-from-path "hobbit4d/module.scm")
(define-module (std io))
(define (println . args)
 (for-each display args)
 (newline)
 (force-output))

(println "Hello " "world")

 > hob -m -o test test.scm
> ./test
ERROR: In procedure apply:
ERROR: Wrong type argument in position 1: #<unspecified>