Skip to content

Conversation

@nekevss
Copy link
Member

@nekevss nekevss commented Sep 11, 2025

Closes #547

This basically removes the NowBuilder approach for a trait based approach.

In order to do this, it adds the HostClock, HostTimeZone, and HostHooks traits. I could see adding the HostHooks trait as potentially superfluous / controversial with the other two traits already present, but I thought it may provide a bit cleaner interface. Let me know what you think. Definitely willing to work shop this one a bit more if need be.

I did test this in Boa locally and there shouldn't be any regressions, which is nice.

@nekevss nekevss requested a review from Manishearth September 11, 2025 23:26
Copy link
Contributor

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

Design looks good overall. I don't use any of this in V8, I just implement it from scratch (it's not much).

src/host.rs Outdated

// Implement empty providers

impl HostClock for () {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I'd make an EmptyProvider type that documents its behavior

@nekevss nekevss merged commit 947052b into main Sep 12, 2025
8 checks passed
@nekevss nekevss deleted the refactor-now branch September 14, 2025 16:15
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.

Update NowBuilder to be trait based

3 participants