unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mikael Djurfeldt <mdj@kvast.blakulla.net>
Cc: djurfeldt@nada.kth.se
Subject: Re: parallel with no exprs
Date: Mon, 09 Jun 2003 10:35:50 +0200	[thread overview]
Message-ID: <xy78ysbtzq1.fsf@kvast.blakulla.net> (raw)
In-Reply-To: <87y90cfcjy.fsf@zip.com.au> (Kevin Ryde's message of "Mon, 09 Jun 2003 08:07:45 +1000")

Kevin Ryde <user42@zip.com.au> writes:

> I tried using parallel with no expressions,
>
> 	(use-modules (ice-9 threads))
> 	(call-with-values
> 	    (lambda ()
> 	      (parallel))
> 	  (lambda ()
> 	    (display "hi\n")))
>
> but got
>
> 	ERROR: In procedure lambda:
> 	ERROR: bad body
>
> Is parallel allowed to be called with no expressions?  It'd be pretty
> silly to write that deliberately, but perhaps it could arise from a
> simple-minded macro expansion or something.
>
>         * threads.scm (parallel): For no forms, use `(values)' not `(begin)'.
>
>         * tests/threads.test: New file, exercising "parallel".
>
>
> --- threads.scm.~1.21.~	2003-04-28 07:51:19.000000000 +1000
> +++ threads.scm	2003-06-08 14:31:57.000000000 +1000
> @@ -182,7 +182,7 @@
>  	%thread-handler)))
>  
>  (define-macro (parallel . forms)
> -  (cond ((null? forms) '(begin))
> +  (cond ((null? forms) '(values))
>  	((null? (cdr forms)) (car forms))
>  	(else
>  	 (let ((vars (map (lambda (f)

Please don't apply this patch.

The original code is correct.  The error instead lies in the use of
parallel.  You'll find that for example

 	(use-modules (ice-9 threads))
 	(call-with-values
 	    (lambda ()
              (display "hello\n")
 	      (parallel))
 	  (lambda ()
 	    (display "hi\n")))

will be accepted.  (lambda () (parallel)) correctly yields an error
message since that is a lambda with no expressions in the body.

Best regards,
Mikael


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2003-06-09  8:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-08 22:07 parallel with no exprs Kevin Ryde
2003-06-09  8:35 ` Mikael Djurfeldt [this message]
2003-06-12  1:54   ` Kevin Ryde
2003-06-12  9:27     ` Mikael Djurfeldt
2003-06-13 23:48       ` Kevin Ryde
2003-06-16 18:45         ` Mikael Djurfeldt
2003-06-19  1:40           ` Kevin Ryde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xy78ysbtzq1.fsf@kvast.blakulla.net \
    --to=mdj@kvast.blakulla.net \
    --cc=djurfeldt@nada.kth.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).