From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: primitive eval with module => Unbound variable? Date: Mon, 22 May 2017 21:45:17 +0200 Message-ID: <87shjw3cc2.fsf@pobox.com> References: <87ziec4g62.fsf@gnu.org> <8737c3nu9p.fsf@pobox.com> <87shk24vdo.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1495482349 30743 195.159.176.226 (22 May 2017 19:45:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 22 May 2017 19:45:49 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) Cc: guile-user@gnu.org To: Jan Nieuwenhuizen Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon May 22 21:45:45 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCtGy-0007t9-D6 for guile-user@m.gmane.org; Mon, 22 May 2017 21:45:44 +0200 Original-Received: from localhost ([::1]:44606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCtH3-0001nm-S5 for guile-user@m.gmane.org; Mon, 22 May 2017 15:45:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCtGk-0001nh-Bb for guile-user@gnu.org; Mon, 22 May 2017 15:45:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCtGh-0003z9-7L for guile-user@gnu.org; Mon, 22 May 2017 15:45:30 -0400 Original-Received: from pb-sasl1.pobox.com ([64.147.108.66]:51239 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dCtGh-0003yr-2C; Mon, 22 May 2017 15:45:27 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 307F36CD20; Mon, 22 May 2017 15:45:26 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=0qzY+7OZM5cu8Vk/RJUvQgdutSY=; b=tJ10Fr ykdrL47x+ZKS/F0aLLLtKOgEWopOQxMyEuHh6U+9VKzfTezARAM58IZh93KicKVO HM+Awn7dI10g7S8eyGlcZjjENGx5LfavUANQQM1XBFczW1Gsj9+LOpfodQzSnYDr aLUTPaczq+2BLa3B1p9+08bCg9QdUre9YAD3E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=Nb+22cAPVfcmsLdEv8OqdXNM/eOebSiG qjW8pjnp84/v1EF/NPPg1+NlPzTJDPwSGqlyZl5qOwL4ATNelK/hHB2HoNRctPl6 CulgKwREE+XSVYi0nnHVabLwkoJ7waTBOLeq5+gO7xbEfuDlNuG6gGBpOvdlxFGg CozO1bAq9Eg= Original-Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 189DB6CD1D; Mon, 22 May 2017 15:45:26 -0400 (EDT) Original-Received: from clucks (unknown [81.34.20.186]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl1.pobox.com (Postfix) with ESMTPSA id 13C4D6CD1C; Mon, 22 May 2017 15:45:24 -0400 (EDT) In-Reply-To: <87shk24vdo.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Thu, 18 May 2017 06:54:59 +0200") X-Pobox-Relay-ID: 3329BEA4-3F27-11E7-98A3-9BB2D5707B88-02397024!pb-sasl1.pobox.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.108.66 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:13736 Archived-At: On Thu 18 May 2017 06:54, Jan Nieuwenhuizen writes: >> This is the right thing: >> >> (define-module (foo) #:export (baz)) >> (define eval-module (current-module)) >> (define bar 42) >> (define (baz) (eval 'bar eval-module)) > > Thanks!...this works. I'm very happy with this, it means that I can > create an sexp-object format, yay! > > Earlier I tried several things eval, but did not see this `define > eval-module' coming. The above works, this does not work > > (define-module (foo) #:export (baz)) > (define bar 42) > (define (baz) (eval 'bar (current-module))) current-module is dynamically scoped. Consider: (define-module (qux) #:use-module (foo)) (baz) In this case the current module for the baz invocation is (qux). Andy