From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16828 invoked by alias); 17 Sep 2017 18:49:59 -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 16491 invoked by uid 89); 17 Sep 2017 18:49:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1424 X-HELO: mail-wm0-f49.google.com Received: from mail-wm0-f49.google.com (HELO mail-wm0-f49.google.com) (74.125.82.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 17 Sep 2017 18:49:48 +0000 Received: by mail-wm0-f49.google.com with SMTP id e71so17550035wmg.4 for ; Sun, 17 Sep 2017 11:49:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=coJev9bfkZCf7w4HKBJre+DGYF1ZWnOsJl4TVE45ubo=; b=bLo9QQSoRwqL0DhnPcPUOIF5ssE8Jp9rGMoDbGWcPaCPjP2lrSHG1YX+o3Bo0Tw2SJ /Mbfk+P1v+yTq5dtoWUCtR+VEM9KBa3TmWokqBYwp6Wple6XSCgwvpNv3cvk3BCl4b8R FdN84QviK28uTl80waTeZbXTi0kSNzFmiknJBT64r/Zb4UE/x3hB/FMIDCeU/pupA/yU qGbbRW+h9yOJzQfEtAwjzi2FuALFLKKyxrJKfaGycD8vOhUop3OfJoU07/z+GwGRbAIp 4UB6AoWzZyJZHlSc6n5zF8EEFp1zrsT+BvQ3dbg+A1u+GNcxzqLzT8cE5gQE3O5DdK6c JIVA== X-Gm-Message-State: AHPjjUgGw5TeXJu4vm3L9w10pDgNTIKupmObXP5CNemu7dWGirn7kieP mxrdiCDmcYqPvQZi4VJwNDJovQJJRPAaIZfIQ51Vqw== X-Google-Smtp-Source: AOwi7QClFQh9/HMEly30PDSplTC8AYMy5nzgA5OPUFJAF7P985ZjOW9l0Z/v/vRy/j65hvv8AeQbQMOYfKkmXzS7zmA= X-Received: by 10.28.111.71 with SMTP id k68mr7521982wmc.64.1505674186352; Sun, 17 Sep 2017 11:49:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.200.2 with HTTP; Sun, 17 Sep 2017 11:49:45 -0700 (PDT) In-Reply-To: References: From: Sonny To Date: Sun, 17 Sep 2017 18:49:00 -0000 Message-ID: Subject: Re: scoping rules To: Per Bothner Cc: Kawa mailing list Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2017-q3/txt/msg00054.txt.bz2 ok let me see if i can reproduce this outside of android On Sun, Sep 17, 2017 at 10:45 AM, Per Bothner wrote: > 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/