From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118750 invoked by alias); 17 Sep 2017 17:45:52 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 118261 invoked by uid 89); 17 Sep 2017 17:45:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 17 Sep 2017 17:45:42 +0000 Received: from [10.9.9.212] (helo=mailfront12.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1dtddT-0003O9-Jw for kawa@sourceware.org; Sun, 17 Sep 2017 19:45:39 +0200 Received: from 70-36-239-177.dsl.dynamic.fusionbroadband.com ([70.36.239.177] helo=localhost.localdomain) by mailfront12.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1dtddR-00009R-1c for kawa@sourceware.org; Sun, 17 Sep 2017 19:45:37 +0200 Subject: Re: scoping rules To: kawa@sourceware.org References: From: Per Bothner Message-ID: Date: Sun, 17 Sep 2017 17:45:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-q3/txt/msg00053.txt.bz2 On 09/17/2017 09:51 AM, Sonny To wrote: > sorry for the newb question but i find this behavior odd > > (let ((handler (android.os.Handler (android.os.Looper:getMainLooper))) > (c context)) > (handler:post (lambda () > (let ((t (android.widget.Toast:makeText (as > android.app.Application c) "foobar" 1000))) > (t:show)) > ))) > > To get this example to work I had to bind c context in the top level let > in the second let, I have to use c instead of context directly. > (android.widget.Toast:makeText (as android.app.Application context) > will complain > > /dev/stdin:45:93: unbound location: context > > it could not see the context binding. > Should it not look in the environment? context is definitely in the > environment because the c binding works That does sound like a bug. Probably the interaction of dynamic (environment) name-lookup combined with the use of the anonymous class. If you can create a simple non-Android test-case I'll take a look. It is recommended to include the line: (define-variable context) as that tells the compiler to look for 'context' in the dynamic environment, and avoids warnings when using --warn-undefined-variable. -- --Per Bothner per@bothner.com http://per.bothner.com/