clojure.core/bean should implement Iterable

Description

The changes in Clojure 1.6 hashing revealed that `bean` does not return a map that implements Iterable:

Patch adds `iterator` method to clojure.core/bean.

Screened by: Alex Miller

Environment

None

Activity

Show:
Ambrose Bonnaire-Sergeant
July 16, 2014, 5:47 PM

Added new patch that just adds iterator to bean.

Ambrose Bonnaire-Sergeant
July 16, 2014, 5:19 PM

It seemed like an oversight that APersistentMap lacked a default iterator method.

That said, I haven't used OO inheritance for 4 years. Should I change the patch?

Alex Miller
July 16, 2014, 5:01 PM

APersistentMap implements Iterable and expects subclasses to fulfill that contract. The bean proxy does not. Instead of changing APersistentMap, why not add:

to the bean proxy definition?

Alex Miller
July 16, 2014, 4:22 PM

One workaround:

Interestingly, into does not help b/c into uses reduce, which internally uses the iterator too.

Completed
Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Unassigned

Reporter

Ambrose Bonnaire-Sergeant

Labels

Approval

Ok

Patch

Code and Test

Priority

Major

Fix versions