guile-user
[Top][All Lists]
Advanced

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

Re: strange error message in macro


From: Linus Björnstam
Subject: Re: strange error message in macro
Date: Thu, 01 Jul 2021 10:02:23 +0200
User-agent: Cyrus-JMAP/3.5.0-alpha0-530-gd0c265785f-fm-20210616.002-gd0c26578

Begin in a Body is spliced into the body. Begin as an expression chain is not 
spliced, and needs at least one expression.

So: begin in definition context (directly in function bodies and at top-level) 
can have 0 expressions. Begin in other contexts must have at least one 
expression.

-- 
  Linus Björnstam

On Thu, 1 Jul 2021, at 09:34, Damien Mattei wrote:
> hello,
> 'begin' complains of 'sequence of zero expressions in form (begin)'
> in:
> scheme@(guile-user)> ($  {x <- 7} {y <- 8} (+ x y))
> While compiling expression:
> Syntax error:
> unknown file:2:0: sequence of zero expressions in form (begin)
> but:
> scheme@(guile-user)> (begin )
> make no error !
> basically $ is a sort of begin macro that call :
> (define-syntax %parse-assignment
>   (syntax-rules ()
> ...
> 
> if i wrote:
> (define-syntax %parse-assignment
>   (syntax-rules (<-)
> there is no more error:
> scheme@(guile-user)> ($  {x <- 7} {y <- 8} (+ x y))
> ;;; <stdin>:5:0: warning: possibly unbound variable `x'
> ;;; <stdin>:5:0: warning: possibly unbound variable `y'
> 15
> result is 15 and good!
> 
> i think that the explanation is with syntax-rules parameters not with
> begin that would not accept zero expression in form , so why this strange
> message?
> i suppose i have trouble understanding the behavior and use of syntax-rules
> parameters anyway and can not find any reliable documentation about it.
> 
> Damien
> 



reply via email to

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