Skip to content

Add support for Clojure metadata#95

Open
dgshep wants to merge 1 commit into
swaroopch:masterfrom
dgshep:add_metadata_support
Open

Add support for Clojure metadata#95
dgshep wants to merge 1 commit into
swaroopch:masterfrom
dgshep:add_metadata_support

Conversation

@dgshep
Copy link
Copy Markdown

@dgshep dgshep commented May 13, 2026

While metadata isn't part of the core EDN spec, it is implemented in the Clojure reader and implemented in other edn handline libraries (e.g. edn-ruby)

This PR adds first-class support for serializing/parsing MetadataValue objects as clojure reader metadata ^{metadata} value

Comment thread edn_format/edn_lex.py
def __eq__(self, other):
if not isinstance(other, MetadataValue):
return False
return self.metadata == other.metadata and self.value == other.value
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the one hand: this doesn't match Clojure's semantics for equality. However, for testing equality between parsed representations, not having this is rather painful. I'm open to suggestions on this one.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW edn-ruby opted to follow Clojure's semantics - see this test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants