public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: daniel szmulewicz <daniel.szmulewicz@gmail.com>
To: kawa@sourceware.org
Subject: Re: The Expression problem
Date: Tue, 30 Aug 2022 21:24:41 +0300	[thread overview]
Message-ID: <CAABPU69g-Qb4EUopv2TT3crN93+V1=vf7sE15D4iPU5c3-0oBQ@mail.gmail.com> (raw)
In-Reply-To: <51486d80-0d3f-aa47-caca-9b23b2618174@bothner.com>

Thank you for the prompt response. This reference indeed tells me how to
create new classes or extend existing classes. However, I was interested in
a way to add functionality without touching existing code. For example,
make all instances on the java.lang.String class respond to `foo`, as in
(foo "a string") -> "bar".
To quote from a paper
<https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.85.2323&rep=rep1&type=pdf>,
"the expression problem (aka the extensibility problem) refers to a
fundamental dilemma of programming: to which degree can your application be
structured in such a way that both the data model and the set of virtual
operations over it can be extended without the need to modify existing
code, without the need for code repetition and without runtime type errors."
Not all languages have viable solutions to the Expression problem. Clojure
and ABCL haved designs that address it, and I was wondering where Kawa is
positioned.

Kind regards, Daniel


On Tue, Aug 30, 2022 at 1:12 AM Per Bothner <per@bothner.com> wrote:

> On 8/29/22 14:35, daniel szmulewicz via Kawa wrote:
>
> > I was wondering what was Kawa's stance regarding the Expression problem,
> > ie. extending existing Java classes.
> > ABCL provides a mechanism to specialize on Java classes as documented in
> > section 4.5.2 of the user manual. Clojure provides defprotocol and
> defmulti
> > to extend existing types. I skimmed through the Kawa manual and am still
> > unsure. I am very curious to hear more from the experts.
>
> You can definitely extend existing Java classes and inetrfaces.  See:
>
> https://www.gnu.org/software/kawa/Defining-new-classes.html
>
> True multiple inheritance is supported.
> --
>         --Per Bothner
> per@bothner.com   http://per.bothner.com/
>

WARNING: multiple messages have this Message-ID
From: daniel szmulewicz <daniel.szmulewicz@gmail.com>
To: kawa@sourceware.org
Subject: Re: The Expression problem
Date: Tue, 30 Aug 2022 21:24:41 +0300	[thread overview]
Message-ID: <CAABPU69g-Qb4EUopv2TT3crN93+V1=vf7sE15D4iPU5c3-0oBQ@mail.gmail.com> (raw)
Message-ID: <20220830182441.D6ITOOhvS4fPehd-TgEWIB70yua5KW-824jh4TzKaA4@z> (raw)
In-Reply-To: <51486d80-0d3f-aa47-caca-9b23b2618174@bothner.com>

[-- Attachment #1: Type: text/plain, Size: 1778 bytes --]

Thank you for the prompt response. This reference indeed tells me how to
create new classes or extend existing classes. However, I was interested in
a way to add functionality without touching existing code. For example,
make all instances on the java.lang.String class respond to `foo`, as in
(foo "a string") -> "bar".
To quote from a paper
<https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.85.2323&rep=rep1&type=pdf>,
"the expression problem (aka the extensibility problem) refers to a
fundamental dilemma of programming: to which degree can your application be
structured in such a way that both the data model and the set of virtual
operations over it can be extended without the need to modify existing
code, without the need for code repetition and without runtime type errors."
Not all languages have viable solutions to the Expression problem. Clojure
and ABCL haved designs that address it, and I was wondering where Kawa is
positioned.

Kind regards, Daniel


On Tue, Aug 30, 2022 at 1:12 AM Per Bothner <per@bothner.com> wrote:

> On 8/29/22 14:35, daniel szmulewicz via Kawa wrote:
>
> > I was wondering what was Kawa's stance regarding the Expression problem,
> > ie. extending existing Java classes.
> > ABCL provides a mechanism to specialize on Java classes as documented in
> > section 4.5.2 of the user manual. Clojure provides defprotocol and
> defmulti
> > to extend existing types. I skimmed through the Kawa manual and am still
> > unsure. I am very curious to hear more from the experts.
>
> You can definitely extend existing Java classes and inetrfaces.  See:
>
> https://www.gnu.org/software/kawa/Defining-new-classes.html
>
> True multiple inheritance is supported.
> --
>         --Per Bothner
> per@bothner.com   http://per.bothner.com/
>

  reply	other threads:[~2022-08-30 18:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 21:35 daniel szmulewicz
2022-08-29 21:35 ` daniel szmulewicz
2022-08-29 22:11 ` Per Bothner
2022-08-30 18:24   ` daniel szmulewicz [this message]
2022-08-30 18:24     ` daniel szmulewicz
2022-08-30 18:57     ` Per Bothner
2022-08-30 18:57       ` Per Bothner
2022-08-31  7:13       ` Helmut Eller

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='CAABPU69g-Qb4EUopv2TT3crN93+V1=vf7sE15D4iPU5c3-0oBQ@mail.gmail.com' \
    --to=daniel.szmulewicz@gmail.com \
    --cc=kawa@sourceware.org \
    /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).