public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Sonny To <son.c.to@gmail.com>
To: Per Bothner <per@bothner.com>
Cc: Kawa mailing list <kawa@sourceware.org>
Subject: Re: scoping rules
Date: Sun, 17 Sep 2017 18:49:00 -0000	[thread overview]
Message-ID: <CAJxjsJvYx7RjM+jJsvVMuqz3uEhA9e7VUL1zoRXFpbWiBv6N-w@mail.gmail.com> (raw)
In-Reply-To: <ff2d5d86-653f-fc59-72d2-e9868b6aead8@bothner.com>

ok let me see if i can reproduce this outside of android

On Sun, Sep 17, 2017 at 10:45 AM, Per Bothner <per@bothner.com> 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/

  reply	other threads:[~2017-09-17 18:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-17 16:51 Sonny To
2017-09-17 17:45 ` Per Bothner
2017-09-17 18:49   ` Sonny To [this message]
2017-09-18  8:29     ` Sonny To
2017-09-18  8:31       ` Sonny To
2017-09-18 12:34       ` Sonny To

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJxjsJvYx7RjM+jJsvVMuqz3uEhA9e7VUL1zoRXFpbWiBv6N-w@mail.gmail.com \
    --to=son.c.to@gmail.com \
    --cc=kawa@sourceware.org \
    --cc=per@bothner.com \
    /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).