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>, Kawa mailing list <kawa@sourceware.org>
Subject: Re: putting symbols into Environment
Date: Fri, 15 Sep 2017 12:48:00 -0000	[thread overview]
Message-ID: <CAJxjsJvvPmORvtcPLn1XQ65A27Nx-mTy07vGfoQDp67Er_QFhw@mail.gmail.com> (raw)
In-Reply-To: <CAJxjsJv-_yabJvr7PkxyqKS+b7bQ2RoL40ORsfJG5vmRv0KAWA@mail.gmail.com>

How close does kawa stick to standard scheme? I'm trying these
functions described here
https://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ref/Environment-Operations.html
and none of work

#|kawa:5|# (define e (environment))
#|kawa:6|# (environment-bindings e)
/dev/stdin:6:2: unbound location: environment-bindings
at gnu.expr.ReferenceExp.apply(ReferenceExp.java:163)
at gnu.expr.Expression.applyMethodExpression(Expression.java:41)
at java.lang.reflect.Method.invoke(Native Method)
at gnu.mapping.CallContext$ReflectMethodHandle.invokeExact(CallContext.java:726)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:586)
at gnu.mapping.CallContext.getFromContext(CallContext.java:616)
at gnu.expr.Expression.eval(Expression.java:52)
at gnu.expr.ApplyExp.apply(ApplyExp.java:161)
at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:281)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211)
at kawa.Shell.run(Shell.java:283)
at kawa.Shell.run(Shell.java:196)
at kawa.Shell.run(Shell.java:183)
at kawa.TelnetRepl.apply0(TelnetRepl.java:25)
at gnu.mapping.RunnableClosure.run(RunnableClosure.java:75)
at java.lang.Thread.run(Thread.java:764)
#|kawa:7|# (environment-bound-names e)
/dev/stdin:7:2: unbound location: environment-bound-names
at gnu.expr.ReferenceExp.apply(ReferenceExp.java:163)
at gnu.expr.Expression.applyMethodExpression(Expression.java:41)
at java.lang.reflect.Method.invoke(Native Method)
at gnu.mapping.CallContext$ReflectMethodHandle.invokeExact(CallContext.java:726)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:586)
at gnu.mapping.CallContext.getFromContext(CallContext.java:616)
at gnu.expr.Expression.eval(Expression.java:52)
at gnu.expr.ApplyExp.apply(ApplyExp.java:161)
at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:281)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211)
at kawa.Shell.run(Shell.java:283)
at kawa.Shell.run(Shell.java:196)
at kawa.Shell.run(Shell.java:183)
at kawa.TelnetRepl.apply0(TelnetRepl.java:25)
at gnu.mapping.RunnableClosure.run(RunnableClosure.java:75)
at java.lang.Thread.run(Thread.java:764)

On Fri, Sep 15, 2017 at 4:48 AM, Sonny To <son.c.to@gmail.com> wrote:
> Thanks Per. I was looking for a Symbol.makeIntern but didnt find one
> and used Symbol.makeUninterned. I was not expecting a Symbol.valueOf
> to make an interned symbol. perhaps either rename or add an alias
> Symbol.makeIntern?
>
> In anycase, using Symbol.valueOf still does not make the "context"
> symbol available in my repl
>
> sto@obi:~$ telnet localhost 9999
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> #|kawa:1|# context
> /dev/stdin:1:1: unbound location: context
> at gnu.expr.ReferenceExp.apply(ReferenceExp.java:163)
> at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:281)
> at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211)
> at kawa.Shell.run(Shell.java:283)
> at kawa.Shell.run(Shell.java:196)
> at kawa.Shell.run(Shell.java:183)
> at kawa.TelnetRepl.apply0(TelnetRepl.java:25)
> at gnu.mapping.RunnableClosure.run(RunnableClosure.java:75)
> at java.lang.Thread.run(Thread.java:764)
>
> any other ideas? I suspect its because I have the wrong Environment
>
> On Wed, Sep 13, 2017 at 5:28 PM, Per Bothner <per@bothner.com> wrote:
>> On 09/13/2017 05:05 PM, Sonny To wrote:
>>>
>>> I'm trying to use the TelnetRepl in an android Service but cannot
>>> figure out how to put bindings into the environment
>>
>>
>>>                      env.put(Symbol.makeUninterned("context", null),
>>> applicationContext)
>>
>>
>>> I can telnet to it but the "context" symbol is not available
>>>
>>> #|kawa:4|# context
>>> /dev/stdin:4:1: unbound location: context
>>
>>
>> That would be expected if you use Symbol.makeUninterned.
>> An uninterned symbol is a unique object that you can *not*
>> "lookup".  For example (string->symbol "context") is the
>> same as 'symbol - but (Symbol:makeUninterned "context") is a completely
>> different object.
>>
>> Instead, try Symbol.valueOf("context").
>>
>>> Do I have the wrong environment? if so how to get the correct environment?
>>
>>
>> There might be other problems, but fix the above-mentioned problem first.
>> --
>>         --Per Bothner
>> per@bothner.com   http://per.bothner.com/

  parent reply	other threads:[~2017-09-15 12:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14  0:05 Sonny To
2017-09-14  0:28 ` Per Bothner
     [not found]   ` <CAJxjsJv-_yabJvr7PkxyqKS+b7bQ2RoL40ORsfJG5vmRv0KAWA@mail.gmail.com>
2017-09-15 12:48     ` Sonny To [this message]
2017-09-15 14:55       ` Per Bothner
2017-09-15 13:48     ` 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=CAJxjsJvvPmORvtcPLn1XQ65A27Nx-mTy07vGfoQDp67Er_QFhw@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).