unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: guile-devel@gnu.org
Subject: Inconsistent 'return value' for definitions
Date: Sun, 29 Jan 2012 17:38:17 -0500	[thread overview]
Message-ID: <87pqe2jfs6.fsf@netris.org> (raw)

Hello all,

I think the following behavior is inconsistent and undesirable:

  scheme@(guile-user)> (list (compile '(define foo 3)))
  $1 = (#<unspecified>)
  scheme@(guile-user)> (list (primitive-eval '(define foo 3)))
  $2 = (#<variable 103b9c80 value: 3>)

It doesn't really make sense for 'define' to return a value, because it
cannot be used in expression context.  AFAICT, the only way to get this
'return value' is to call 'eval' or 'primitive-eval'.  This weirdness
has bitten Paul Smith in his efforts to port his code to Guile 2.

I think we should change 'define' to always "return" SCM_UNSPECIFIED, at
least in 2.2.  We might also consider nipping this in the bud and making
the same change in 2.0.4.

    Thanks,
      Mark



             reply	other threads:[~2012-01-29 22:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-29 22:38 Mark H Weaver [this message]
2012-01-29 23:14 ` [PATCH] Fix primitive-eval to return #<unspecified> for definitions Mark H Weaver
2012-01-30 10:58   ` Andy Wingo

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=87pqe2jfs6.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guile-devel@gnu.org \
    /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).