Using `proxy` might make an otherwise additive change breaking

Description

Per https://ask.clojure.org/index.php/10383/using-proxy-might-make-otherwise-additive-change-breaking ...

Given an interface

And a proxy over that interface:

When the interface gets updated to

Calls to instanceCreatedByProxy.bar(o, p) will not work as it could be expected.

reify is not affected by this.

Repro repo: https://github.com/imrekoszo/proxy-default

There is no indication of this behavior in the docstring of proxy, the only reference I saw to this is an example on clojuredocs.

This is troublesome as it might prevent an otherwise non-breaking library upgrade. If the code calling proxy is under one's control they could use reify instead (especially as this is [https://clojure.org/reference/datatypes#_reify|recommended in the official docs]). However if it is in an external library this is not a viable workaround.

Is this a bug or a known limitation of proxy? If the latter, then could this perhaps be made more visible, for example through a warning in the docstring?

See also: slack thread

Environment

None

Activity

Show:
Ghadi Shayban
March 30, 2021, 5:46 PM

Is it salient that the addition to the interface is a default method with the same name? Would it be the same issue with a non-default method?

Assignee

Unassigned

Reporter

Alex Miller

Approval

Triaged

Priority

Major

Affects versions