From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Maciek Godek" Newsgroups: gmane.lisp.guile.user Subject: Re: Me no understand scoping Date: Sat, 2 Aug 2008 00:00:10 +0200 Message-ID: References: <87r69ccaus.fsf@unknownlamer.org> <489074A9.1080508@wilsonjc.us> <49dd78620807310020i8b55067gd22f6ce361a04d7d@mail.gmail.com> <874p657gyo.fsf@unknownlamer.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1217628029 19981 80.91.229.12 (1 Aug 2008 22:00:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 1 Aug 2008 22:00:29 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Aug 02 00:01:19 2008 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KP2gY-0000Yv-RC for guile-user@m.gmane.org; Sat, 02 Aug 2008 00:01:19 +0200 Original-Received: from localhost ([127.0.0.1]:45080 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KP2fe-0008S3-1G for guile-user@m.gmane.org; Fri, 01 Aug 2008 18:00:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KP2fY-0008Pm-DQ for guile-user@gnu.org; Fri, 01 Aug 2008 18:00:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KP2fW-0008Nt-UR for guile-user@gnu.org; Fri, 01 Aug 2008 18:00:16 -0400 Original-Received: from [199.232.76.173] (port=42009 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KP2fW-0008NU-Np for guile-user@gnu.org; Fri, 01 Aug 2008 18:00:14 -0400 Original-Received: from wf-out-1314.google.com ([209.85.200.169]:24359) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KP2fW-00040m-IQ for guile-user@gnu.org; Fri, 01 Aug 2008 18:00:14 -0400 Original-Received: by wf-out-1314.google.com with SMTP id 28so1134199wfc.24 for ; Fri, 01 Aug 2008 15:00:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=q1+/NNZp7rYQz4uC3g+WCYQ6hwp94qERD99y+AbnNP4=; b=Mg6boTsM66c9fNuqxJaDk3OIuDVn+PDY+ERJvUe5OEBS0ltJojgx14svvL2yUTHiyU WwMiuewYCaJbrqTvjgQ2uA7d/Ke+5n90CN269Oe4srl/tU59dBzTBemLNnL3rAoGiJ/e uzJ+ooW/I6k1DddCHIS5vQZE5TwHcHDXuiklk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=MZ0UShpvEO9Tiw0TtnGY0bW8KXzEnhDgwHK8LUS7XTDD0JjVAx3YHgpWB3OsaK0eks 3KAbjGTaCnUjBwakhmaNtN2pNKac4dqQbf2ZD+Ib3LZ5X8gpynRSw171ehdLnzrBMfn/ wUmNbNo3izucvc3tXmUMAR0hRcdmSJ8mBBYYE= Original-Received: by 10.142.223.4 with SMTP id v4mr3925260wfg.107.1217628011027; Fri, 01 Aug 2008 15:00:11 -0700 (PDT) Original-Received: by 10.142.141.17 with HTTP; Fri, 1 Aug 2008 15:00:10 -0700 (PDT) In-Reply-To: <874p657gyo.fsf@unknownlamer.org> Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:6716 Archived-At: 2008/8/1 Clinton Ebadi : > > module-define! MODULE NAME VALUE > > e.g. > (let ((foo 'bar)) > (module-define! (current-module) foo 5) > bar) > => 5 > > Issue: this will be a top level binding, but a solution using `eval' > would also produce a top level binding (as it executes there to allow > lexical environments to be optimized...). I've been trying to make it using local-eval to be able to make a definition within a closure. There's only a tiny problem: it's not working. When I execute: (local-eval (list 'define a 5) (the-environment)) everything works fine, but when I make a function of it, (define (define@ name value) (local-eval (list 'define name value) (the-environment))) and when I invoke it, it breaks with "Bad define placement". The problem gets solved when I make a macro of it: (define-macro (define@ name value) `(local-eval (list define ,name ,value)(the-environment))) but it still breaks when called from a nested local-eval. > Doing such things, however, is fairly unschemey. What things and why? What I'm trying to do is to understand the rules of making and using environments. As for now, these rules seem to be quite random and unpredictable (so it's rather hard to call them rules actually), which is sad because closures are a very powerful yet simple mechanism (definitely simpler than what GOOPS or CLOS have to offer if it comes to OOP -- both in concepts and implementation) See you around :) M.