[Top][All Lists]

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

Re: syncase code issue 1.8.8 -> 2.0.11

From: Panicz Maciej Godek
Subject: Re: syncase code issue 1.8.8 -> 2.0.11
Date: Thu, 18 Sep 2014 09:49:27 +0200

2014-09-18 3:18 GMT+02:00 Matt Wette <address@hidden>:
Hi Folks,

Anyone interested in looking at my syntax-case code?   I wrote this several years ago under 1.8.8.  Now moving to 2.0.11: not working :(.


In 1.8.8, I get the above output.   In 2.0.11 I get

Syntax-case macros are now a part of Guile core; importing (ice-9 syncase) is no longer necessary.   <=(no issue here)
ice-9/psyntax.scm:1274:12: In procedure dobody:
ice-9/psyntax.scm:1274:12: Syntax error:
u1.scm:106:18: definition in _expression_ context, where definitions are not allowed

I haven't time to look at your code more closely, but the error message is quite informative here: clearly the usage of your macro introduces a definition in _expression_ context, which doesn't conform to the Scheme specification. It seems that guile 1.8 treated definitions like expressions, but it is no longer the case.

Apparently, your code expands to a series of definitions. Therefore the invocation

(format #t "~a\n" (define-tokenizer tokiz ("[0-9]+" #\1) ("[a-z]+" #\a)))

makes no sense (e.g. because "define-tokenizer" produces no value, that should be passed to format, and after expansion it contains no _expression_ that could be evaluated), and neither does

(format #t "~a\n" (define mt (make-tokiz "abc=def"))) 

I don't know what was your intention in the first case, but you could rearrange the second line in the following way:

(define mt (make-tokiz "abc=def"))
(format #t "~a\n" mt) 

The first line could simply be replaced with the sole definition, i.e.
(define-tokenizer tokiz ("[0-9]+" #\1) ("[a-z]+" #\a))

(I am guessing that the invocation from within "format" stems from debugging)


reply via email to

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