Skip to content

Add support for *print-meta*#741

Open
djblue wants to merge 1 commit intojank-lang:mainfrom
djblue:print-meta
Open

Add support for *print-meta*#741
djblue wants to merge 1 commit intojank-lang:mainfrom
djblue:print-meta

Conversation

@djblue
Copy link
Copy Markdown
Contributor

@djblue djblue commented Apr 19, 2026

No description provided.

}
else
{
visit_object([&](auto const typed_o) { buff(typed_o->to_code_string()); }, o);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wonder if to_code_string should have an overload that also accepts a buffer?

auto const value{ visit_object([](auto const typed_o) { return typed_o->to_code_string(); },
o) };
buff(value);
auto const print_meta(make_box<obj::symbol>("clojure.core", "*print-meta*"));
Copy link
Copy Markdown
Member

@jeaye jeaye Apr 19, 2026

Choose a reason for hiding this comment

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

These two to_code_string functions are no longer actually needed. We now have a to_code_string on the object. In fact, we don't even need to visit the object anymore to be able to get that, since it's now a virtual function.

So these global to_code_string functions should be considered deprecated. The vast majority of the time, when we do to_code_string, we will NOT be using these functions. So we need to handle this differently. Perhaps we will need to handle this in each object's to_code_string function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In looking through some of the method implementations for to_code_string, I found a few that reference these functions, such as range.cpp. Should those functions be updated to call the method instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah, we ultimately just want to remove those old uses entirely. jank is in a transitional state between the closed object model and the open object model right now. visit, as well, is the old way of doing things, but we need to build out the virtual fns on object more in order to replace it.

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