Skip to content

Conversation

@jackfirth
Copy link
Contributor

This pull request changes the pretty syntax parameter to an ordinary function that calls whatever function is in current-pretty. This removes the need for the #:default keyword in define-pretty, and as a result the #:let keyword isn't needed anymore either. This makes define-pretty macro uses a bit more readable since they can now use ordinary default function arguments and local definitions.

This commit changes the `pretty` syntax parameter to an ordinary function that calls whatever function is in `current-pretty`. This removes the need for the `#:default` keyword in `define-pretty`, and as a result the `#:let` keyword isn't needed anymore either. This makes `define-pretty` macro uses a bit more readable, since they can now use ordinary default function arguments and ordinary local definitions.
@sorawee
Copy link
Owner

sorawee commented Oct 31, 2024

Oh, I think I did it that way to break the cycle, because pretty is actually not a function, but rather a shorthand for (unbox (current-pretty))?

https://github.com/sorawee/fmt/blob/master/core.rkt#L136

The fact that your PR passes the CI is puzzling to me though. Maybe things work and there's no need to break the cycle after all?

@jackfirth
Copy link
Contributor Author

Yeah the cycle is fine. Indirection through the box is enough to break it. Though I am surprised it uses a box at all instead of a parameter.

@sorawee
Copy link
Owner

sorawee commented Oct 31, 2024

I recall I benchmarked at some point and found box to be significantly faster? Not sure though.

@jackfirth
Copy link
Contributor Author

Ah, that makes sense. Parameters have the overhead of thread cells to worry about.

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