public inbox for
 help / color / mirror / Atom feed
From: Jamison Hope <>
To: "" <>
Subject: Re: Working with string keys in a java.util.Map
Date: Fri, 3 Jul 2020 21:30:59 -0400	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

In this case, I think another option is to define a wrapper function that
specifies the argument type as String, like:

(define (get attrs key::String) (attrs:get key))

Then (get attrs “owner”) ought to work with the literal converted to


On Fri, Jul 3, 2020 at 6:33 PM Per Bothner <> wrote:

> On 7/3/20 2:52 PM, Sudarshan S Chawathe wrote:
> > I've had to get Java "String"s from Kawa strings often for similar
> > reasons when using other JVM libraries, etc., and I have just used
> > '(String "kawa string)'; it seems to work well, although it does
> > introduce clutter.
> I don't see how to avoid that in general.  One could write a wrapper Map
> that uses a coercion function to convert the key to required type,
> similar to the coercion function in the make-parameter function.
> Another way is to call the toString method, since Kawa strings
> implement java.lang.CharSequence:
>    ("kstring":toString)
> This is cheap if the Kawa string is an IString, since uses a
> java.lang.String.
> Alternative syntax:
> (->java.lang.String "kstring")
> or shorter:
> (->String "kstring")
> --
>         --Per Bothner
Jamison Hope

  reply	other threads:[~2020-07-04  1:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03 21:46 Duncan Mak
2020-07-03 21:52 ` Sudarshan S Chawathe
2020-07-03 22:33   ` Per Bothner
2020-07-04  1:30     ` Jamison Hope [this message]
2020-07-04  4:04       ` Duncan Mak
2020-07-04  4:29         ` Sudarshan S Chawathe
2020-07-04  5:24         ` Per Bothner

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:

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

  git send-email \ \ \ \

* 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).