This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Guile: Weirdness in syncase module?


Hello all,

Playing around with Guile, I have experienced a problem trying to use
the syncase module.

Disclaimer 1: I have checked the docs in /usr/doc and /usr/doc/Cygwin,
the man and info pages, and have done a site-restricted Google search on
the archives with 'guile syntax' and 'guile syncase'. No luck there.

Disclaimer 2: This may not relate specifically to the Cygwin
implementation of Guile + modules, but I thought it best to try here
first.

WEIRDNESS 0. Perhaps this isn't really weird, but I just wondered why,
since define-syntax, syntax-rules and friends are specified as part of
the core Scheme language in R5RS (which the info pages claim to
implement), one has to load a module to use them. However, probably OT
(ie not Cygwin-specific), so never mind.

WEIRDNESS 1. See the following transcript:

    guile> (use-modules (ice-9 syncase))
    /usr/share/guile/1.5.6/ice-9/syncase.scm:171:18: In expression
(make-mutex):
    /usr/share/guile/1.5.6/ice-9/syncase.scm:171:18: Unbound variable:
make-mutex
    ABORT: (unbound-variable)
    guile> (use-modules (ice-9 syncase))
    guile> define-syntax
    #<macro! sc-macro>

The first attempt to load (ice-9 syncase) always gives me that error
message about make-mutex, and then a subsequent attempt to load it
works, in the sense that no error message is generated and define-syntax
is there as a variable whose value is the macro sc-macro. However...

WEIRDNESS 2. Any attempt to actually use define-syntax fails, eg

    guile> (define-syntax nothing-but-the-truth
    ...      (syntax-rules ()
    ...         ((_) #t)))
    /usr/share/guile/1.5.6/ice-9/syncase.scm:70:7: In expression
(sc-expand exp):
    /usr/share/guile/1.5.6/ice-9/syncase.scm:70:7: Wrong type to apply:
#f
    ABORT: (misc-error)
    guile>

Having a look at syncase.scm goes some way to explaining this: 

* define-syntax is defined in terms of sc-macro:

    82:    (define define-syntax sc-macro)

* sc-macro is implemented using sc-expand:

    67:    (define sc-macro
    68:      (procedure->memoizing-macro
    69:        (lambda (exp env)
    70:          (sc-expand exp))))

* and sc-expand is defined as false:

    74:    (define sc-expand #f)

So it looks like the expression (define-syntax blah-blah ...) is winding
up as (#f blah-blah ...), which explains the error message.

Could something like a re-definition of sc-expand have fallen off the
end of the file? Or should one load some other module/package first, or
afterwards?

Output of cygcheck -svr attached as cygcheck.txt.

Cheers,
Jason

_____________________________________________
Jason C. Johnston
mailto:jason@astadhyayi.net
http://www.astadhyayi.net
 

Attachment: cygcheck.txt
Description: Text document

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

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